DBObjectDirectoryAdapter class

A DBObjectAdapter that stores objects in a Directory.

Simulates an Object Database adapter. Useful for development.

Inheritance
Available extensions

Constructors

DBObjectDirectoryAdapter(Directory directory, {bool generateTables = false, Object? populateTables, Object? populateSource, Object? populateSourceVariables, EntityRepositoryProvider? parentRepositoryProvider, String? workingPath, bool log = false})

Properties

callCloseTransactionRequired bool
no setteroverride
cancelTransactionResultWithError bool
no setteroverride
capability DBAdapterCapability
The DBAdapter capability.
finalinherited
connectionInactivityLimit Duration
The maximum allowed duration of inactivity for a connection in the pool. Default: 15min
getter/setter pairinherited
dialect DBDialect
The DB dialect of this adapter.
no setterinherited
dialectName String
The DB dialect name of this adapter.
no setterinherited
directory Directory
final
entityRepositories List<EntityRepository<Object>>
no setterinherited
entityRepositoriesBuildOrder List<EntityRepository<Object>>
no setterinherited
hashCode int
The hash code for this object.
no setterinherited
initializationStatus InitializationStatus
Returns the current InitializationStatus.
no setterinherited
instanceID int
finalinherited
isAsyncInitialization bool
Returns true if this instance initialization was asynchronous.
no setterinherited
isClosed bool
no setterinherited
isInitialized bool
Returns true if this instance is already initialized.
no setterinherited
isInitializing bool
Returns true if this instance is in the middle of the initialization process.
no setterinherited
isPoolEmpty bool
no setterinherited
isPoolNotEmpty bool
no setterinherited
lastCheckPoolElapsedTimeMs int
no setterinherited
log bool
finalinherited
maxConnections int
The maximum number of connections in the pool of this adapter.
finalinherited
minConnections int
The minimum number of connections in the pool of this adapter.
finalinherited
name String
The name of the adapter.
finalinherited
onClose Stream<DBAdapter<DBObjectDirectoryAdapterContext>>
On close events.
latefinalinherited
parentRepositoryProvider EntityRepositoryProvider?
finalinherited
poolAliveElementsSize int
no setterinherited
poolCreatedElementsCount int
no setterinherited
poolDisposedElementsCount int
no setterinherited
poolElements Iterable<DBObjectDirectoryAdapterContext>
no setterinherited
poolFullWaitTimeout Duration
no setterinherited
poolFullYieldTimeout Duration
no setterinherited
poolSize int
no setterinherited
poolSizeDesiredLimit int
no setterinherited
poolYieldTimeout Duration
no setterinherited
registeredEntityRepositories List<EntityRepository<Object>>
no setterinherited
registeredEntityRepositoriesInformation Map<EntityRepository<Object>, Object>
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited
tablesSchemes Map<String, TableScheme>
final
throwTransactionResultWithError bool
no setteroverride

Methods

addTableSchemes(Iterable<TableScheme> tablesSchemes) → void
allRepositories({Map<Type, EntityRepository<Object>>? allRepositories, Set<EntityRepositoryProvider>? traversedProviders}) Map<Type, EntityRepository<Object>>
inherited
callCheckPool() FutureOr<bool>
inherited
cancelTransaction(Transaction transaction, DBObjectDirectoryAdapterContext? connection, Object? error, StackTrace? stackTrace) bool
override
catchFromPool({Duration? timeout}) FutureOr<DBObjectDirectoryAdapterContext>
inherited
catchFromPopulatedPool() FutureOr<DBObjectDirectoryAdapterContext?>
inherited
checkConnections() FutureOr<bool>
Checks the connections of the pool. Defaults: calls removeInvalidElementsFromPool.
inherited
checkDB() FutureOr<bool>
inherited
checkEntityFields<O>(O o, String entityName, String table, {EntityHandler<O>? entityHandler}) → void
inherited
checkInitialized() → void
Checks if this instance is initialized.
inherited
checkNotClosed() → void
inherited
checkPool() FutureOr<bool>
Checks the pool connections and limits.
inherited
checkPoolSize(int minSize, int maxSize, int checkInvalidsIntervalMs) FutureOr<bool>
inherited
clearPool() FutureOr<bool>
inherited
close() bool
inherited
closeConnection(DBObjectDirectoryAdapterContext connection) bool
override
closePoolElement(DBObjectDirectoryAdapterContext o) FutureOr<bool>
Defaults: calls closeConnection.
inherited
closeTransaction(Transaction transaction, DBObjectDirectoryAdapterContext? connection) FutureOr<void>
override
createConnection() DBObjectDirectoryAdapterContext
Creates a connection C for this adapte
override
createPoolElement({bool force = false}) FutureOr<DBObjectDirectoryAdapterContext?>
Defaults: calls createConnection.
inherited
createPoolElementForced() FutureOr<DBObjectDirectoryAdapterContext>
inherited
createRepositoryAdapter<O>(String name, {String? tableName, Type? type}) DBRepositoryAdapter<O>?
inherited
disposePoolElement(DBObjectDirectoryAdapterContext o) FutureOr<bool>
inherited
disposeTableSchemeCache(String table) TableScheme?
Disposes a TableScheme for table. Forces refresh of previous scheme.
inherited
doCount(TransactionOperation op, String entityName, String table, {EntityMatcher? matcher, Object? parameters, List? positionalParameters, Map<String, Object?>? namedParameters, PreFinishDBOperation<int, int>? preFinish}) FutureOr<int>
override
doDelete<R>(TransactionOperation op, String entityName, String table, EntityMatcher matcher, {Object? parameters, List? positionalParameters, Map<String, Object?>? namedParameters, PreFinishDBOperation<Iterable<Map<String, dynamic>>, R>? preFinish}) FutureOr<R>
override
doExistIDs<I extends Object>(TransactionOperation op, String entityName, String table, List<I> ids) FutureOr<List<I>>
override
doInitialization({Initializable? parent}) FutureOr<InitializationResult>
Initialize this instance if is not initialized yet.
inherited
doInsert<O>(TransactionOperation op, String entityName, String table, O o, Map<String, dynamic> fields, {String? idFieldName, PreFinishDBOperation? preFinish}) FutureOr
override
doSelectAll<R>(TransactionOperation op, String entityName, String table, {PreFinishDBOperation<Iterable<Map<String, dynamic>>, List<R>>? preFinish}) FutureOr<List<R>>
override
doSelectByID<R>(TransactionOperation op, String entityName, String table, Object id, {PreFinishDBOperation<Map<String, dynamic>?, R?>? preFinish}) FutureOr<R?>
override
doSelectByIDs<R>(TransactionOperation op, String entityName, String table, List<Object> ids, {PreFinishDBOperation<List<Map<String, dynamic>>, List<R>>? preFinish}) FutureOr<List<R>>
override
doUpdate<O>(TransactionOperation op, String entityName, String table, O o, Object id, Map<String, dynamic> fields, {String? idFieldName, PreFinishDBOperation? preFinish, bool allowAutoInsert = false}) FutureOr
override
ensureInitialized({Initializable? parent}) FutureOr<InitializationResult>
Ensures that this instance is initialized.
inherited
ensureInitializedAsync({Initializable? parent}) FutureOr<InitializationResult>
Ensures that this instance is initialized. If is not initialized yet it will force an asynchronous initialization and return a Future.
inherited
executeInitialized<R>(ExecuteInitializedCallback<R> callback, {Initializable? parent}) FutureOr<R>
Executes the callback ensuring that this instances was fully initialized.
inherited
executeTransactionOperation<R>(TransactionOperation op, FutureOr<R> f(DBObjectDirectoryAdapterContext connection)) FutureOr<R>
executeWithPool<R>(FutureOr<R> f(DBObjectDirectoryAdapterContext o), {Duration? timeout, bool validator(DBObjectDirectoryAdapterContext o)?, dynamic onError(Object error, StackTrace stackTrace)?}) FutureOr<R>
inherited
filterPoolElements(FutureOr<bool> filter(DBObjectDirectoryAdapterContext o)) FutureOr<List<DBObjectDirectoryAdapterContext>>
inherited
getConnectionURL(DBObjectDirectoryAdapterContext connection) String
Returns the URL of the connection.
override
getEntityByID<O>(dynamic id, {Type? type, bool sync = false, EntityResolutionRules? resolutionRules}) FutureOr<O?>
inherited
getEntityHandler<T>({String? entityName, String? tableName, Type? entityType}) EntityHandler<T>?
inherited
getEntityID(Object entity, {String? entityName, String? tableName, Type? entityType, EntityHandler? entityHandler}) Object?
Returns the entity ID for entityName, tableName or entityType.
inherited
getEntityRepositoresTables() FutureOr<Map<EntityRepository<Object>, String>>
inherited
getEntityRepository<O extends Object>({O? obj, Type? type, String? name, String? tableName}) EntityRepository<O>?
inherited
getEntityRepositoryByType<O extends Object>(Type type) EntityRepository<O>?
inherited
getEntityRepositoryByTypeInfo<O extends Object>(TypeInfo typeInfo) EntityRepository<O>?
inherited
getFieldType(String field, {String? entityName, String? tableName, Type? entityType}) FutureOr<TypeInfo?>
Returns the type for the field at tableName or by entityName.
inherited
getRepositoryAdapterByName<O>(String name) DBRepositoryAdapter<O>?
inherited
getRepositoryAdapterByTableName<O>(String tableName) DBRepositoryAdapter<O>?
inherited
getRepositoryAdapterByType<O>(Type type) DBRepositoryAdapter<O>?
inherited
getTableFieldsTypes(String table) FutureOr<Map<String, Type>?>
Returns a TableScheme.fieldsTypes for table.
inherited
getTableFieldsTypesImpl(String table) FutureOr<Map<String, Type>?>
override
getTableForEntityRepository(EntityRepository<Object> entityRepository) String
Returns the table name for entityRepository.
inherited
getTableForType(TypeInfo type) String?
Returns the table name for type.
inherited
getTableScheme(String table, {TableRelationshipReference? relationship, Object? contextID}) FutureOr<TableScheme?>
Returns a TableScheme for table. Calls getTableSchemeImpl handling asynchronous calls.
inherited
getTableSchemeForEntityRepository(EntityRepository<Object> entityRepository, {Object? contextID}) FutureOr<TableScheme?>
Returns a TableScheme for entityRepository.
inherited
getTableSchemeForType(TypeInfo type) FutureOr<TableScheme?>
Returns a TableScheme for type.
inherited
getTableSchemeIfLoaded(String table) TableScheme?
inherited
getTableSchemeImpl(String table, TableRelationshipReference? relationship, {Object? contextID}) TableScheme?
Implementation that returns a TableScheme for table.
override
information({bool extended = false, String? table}) Map<String, dynamic>
override
initialize() FutureOr<InitializationResult>
Initialization implementation. Do not call it directly, use doInitialization.
inherited
initializeDependencies() List<Initializable>
Return a List of Initializable instances that need to be initialized BEFORE initialize this instance.
inherited
instantiateRepositoryAdapter<O>(String name, String? tableName, Type? type) DBRepositoryAdapter<O>
inherited
invalidPoolElements({bool checkUsage = true}) FutureOr<List<DBObjectDirectoryAdapterContext>>
inherited
isConnectionValid(DBObjectDirectoryAdapterContext connection, {bool checkUsage = true}) FutureOr<bool>
Returns true if connection is valid for usage.
override
isPoolElementInvalid(DBObjectDirectoryAdapterContext o, {bool checkUsage = true}) FutureOr<bool>
inherited
isPoolElementValid(DBObjectDirectoryAdapterContext o, {bool checkUsage = true}) FutureOr<bool>
Defaults: calls isConnectionValid.
inherited
isTransactionWithSingleOperation(TransactionOperation op) bool
inherited
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
notifyKnownEntityRepositoryProvider(EntityRepositoryProvider provider) → void
inherited
notifyTableFieldTypes(String table, Map<String, Type> fieldsTypes) Map<String, Type>
inherited
openTransaction(Transaction transaction) DBObjectDirectoryAdapterContext
override
peekFromPool() FutureOr<DBObjectDirectoryAdapterContext?>
inherited
populateImpl() FutureOr<InitializationResult>
inherited
preparePoolElement(DBObjectDirectoryAdapterContext o) FutureOr<DBObjectDirectoryAdapterContext?>
inherited
recyclePoolElement(DBObjectDirectoryAdapterContext o) FutureOr<DBObjectDirectoryAdapterContext?>
inherited
registerEntityRepository<O extends Object>(EntityRepository<O> entityRepository) → void
inherited
releaseIntoPool(DBObjectDirectoryAdapterContext o) FutureOr<bool>
inherited
removeElementsFromPool(int amount) int
inherited
removeFromPool(DBObjectDirectoryAdapterContext o) bool
inherited
removeInvalidElementsFromPool({bool checkUsage = true}) FutureOr<bool>
inherited
resolveError(Object error, StackTrace stackTrace, Object? operation, Object? previousError) Object
resolveTransactionResult(dynamic result, Transaction transaction, DBObjectDirectoryAdapterContext? connection) FutureOr
inherited
selectIDFieldName(String table, List<String> primaryKeyCandidates) String
Selects the ID field name from primaryKeyCandidates candidates:
inherited
toString() String
A string representation of this object.
override
validPoolElements() FutureOr<List<DBObjectDirectoryAdapterContext>>
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited

Static Methods

boot() → void
fromConfig(Map<String, dynamic>? config, {EntityRepositoryProvider? parentRepositoryProvider, String? workingPath}) FutureOr<DBObjectDirectoryAdapter>