EntiDB class
The main EntiDB database class.
Provides a unified interface for managing collections, handling the database lifecycle, and coordinating cross-cutting concerns like transactions and backups.
Lifecycle
- Open: Use EntiDB.open to open or create a database
- Use: Access collections via collection method
- Close: Call close to flush and release resources
Thread Safety
EntiDB is thread-safe for concurrent access from multiple isolates. Collections are protected by internal locking mechanisms.
Properties
- collectionCount → int
-
The number of registered collections.
no setter
-
collectionNames
→ List<
String> -
The names of all registered collections.
no setter
- config → EntiDBConfig
-
Database configuration.
final
- hashCode → int
-
The hash code for this object.
no setterinherited
- isOpen → bool
-
Whether the database is currently open.
no setter
- path → String?
-
The database file path (null for in-memory).
final
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
close(
) → Future< void> - Closes the database and releases all resources.
-
collection<
T extends Entity> (String name, {required EntityFromMap< T> fromMap}) → Future<Collection< T> > - Gets or creates a typed collection.
-
dropCollection(
String name) → Future< bool> - Drops a collection and deletes its data.
-
flush(
) → Future< void> - Flushes all pending writes to disk.
-
getStats(
) → Future< EntiDBStats> - Gets database statistics.
-
hasCollection(
String name) → bool - Checks if a collection exists.
-
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
toString(
) → String -
A string representation of this object.
override
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited
Static Methods
-
open(
{String? path, EntiDBConfig config = const EntiDBConfig()}) → Future< EntiDB> - Opens or creates a database at the specified path.