abstractDatabaseDriver <C>
Hierarchy
- DatabaseDriver
Implements
Index
Properties
Methods
Properties
[EntityManagerType]
readonlyconfig
Methods
aggregate
Executes a MongoDB aggregation pipeline (MongoDB driver only).
Parameters
entityName: EntityName
pipeline: any[]
Returns Promise<any[]>
close
Closes the primary connection and all read replicas.
Parameters
optionalforce: boolean
Returns Promise<void>
connect
Opens the primary connection and all read replicas.
Parameters
optionaloptions: { skipOnConnect?: boolean }
optionalskipOnConnect: boolean
Returns Promise<C>
convertException
Converts native db errors to standardized driver exceptions
Parameters
exception: Error
Returns DriverException
abstractcount
Counts entities matching the given condition.
Parameters
entityName: EntityName<T>
where: FilterQuery<T>
optionaloptions: CountOptions<T, P>
Returns Promise<number>
countVirtual
Parameters
entityName: EntityName<T>
where: FilterQuery<T>
options: CountOptions<T, any>
Returns Promise<number>
createEntityManager
Creates a new EntityManager instance bound to this driver.
Parameters
optionaluseContext: boolean
Returns EntityManager<DatabaseDriver<C>>
abstractfind
Finds selection of entities
Parameters
entityName: EntityName<T>
where: FilterQuery<T>
optionaloptions: FindOptions<T, P, F, E>
Returns Promise<EntityData<T>[]>
abstractfindOne
Finds single entity (table row, document)
Parameters
entityName: EntityName<T>
where: FilterQuery<T>
optionaloptions: FindOneOptions<T, P, F, E>
Returns Promise<null | EntityData<T>>
findVirtual
Finds entities backed by a virtual (expression-based) definition.
Parameters
entityName: EntityName<T>
where: FilterQuery<T>
options: FindOptions<T, any, any, any>
Returns Promise<EntityData<T>[]>
getConnection
Returns the write connection or a random read replica.
Parameters
type: ConnectionType = 'write'
Returns C
getDependencies
Returns the names of native database dependencies required by this driver.
Returns string[]
getMetadata
Returns the metadata storage used by this driver.
Returns MetadataStorage
getPlatform
Returns the database platform abstraction for this driver.
Returns Platform
loadFromPivotTable
When driver uses pivot tables for M:N, this method will load identifiers for given collections from them
Parameters
prop: EntityProperty<any, any>
owners: (O extends { [PrimaryKeyProp]?: PK } ? PK extends undefined ? Omit<O<O>, typeof PrimaryKeyProp> : PK extends keyof O<O> ? ReadonlyPrimary<UnwrapPrimary<O<O>[PK<PK>]>> : PK extends keyof O<O>[] ? ReadonlyPrimary<PrimaryPropToType<O<O>, PK<PK>>> : PK : O extends { _id?: PK } ? string | ReadonlyPrimary<PK> : O extends { id?: PK } ? ReadonlyPrimary<PK> : O extends { uuid?: PK } ? ReadonlyPrimary<PK> : O)[][]
optionalwhere: any
optionalorderBy: OrderDefinition<T>
optionalctx: any
optionaloptions: FindOptions<T, any, any, any>
optionalpivotJoin: boolean
Returns Promise<Dictionary<T[]>>
lockPessimistic
Acquires a pessimistic lock on the given entity.
Parameters
entity: T
options: LockOptions
Returns Promise<void>
mapResult
Maps raw database result to entity data, converting column names to property names.
Parameters
result: EntityDictionary<T>
optionalmeta: EntityMetadata<T, EntityCtor<T>>
populate: PopulateOptions<T>[] = []
Returns null | EntityData<T>
abstractnativeDelete
Deletes rows matching the given condition.
Parameters
entityName: EntityName<T>
where: FilterQuery<T>
optionaloptions: DeleteOptions<T>
Returns Promise<QueryResult<T>>
abstractnativeInsert
Inserts a single row into the database.
Parameters
entityName: EntityName<T>
data: EntityDictionary<T>
optionaloptions: NativeInsertUpdateOptions<T>
Returns Promise<QueryResult<T>>
abstractnativeInsertMany
Inserts multiple rows into the database in a single batch operation.
Parameters
entityName: EntityName<T>
data: EntityDictionary<T>[]
optionaloptions: NativeInsertUpdateManyOptions<T>
optionaltransform: (sql) => string
Returns Promise<QueryResult<T>>
abstractnativeUpdate
Updates rows matching the given condition.
Parameters
entityName: EntityName<T>
where: FilterQuery<T>
data: EntityDictionary<T>
optionaloptions: NativeInsertUpdateOptions<T>
Returns Promise<QueryResult<T>>
nativeUpdateMany
Updates multiple rows with different payloads in a single batch operation.
Parameters
entityName: EntityName<T>
where: FilterQuery<T>[]
data: EntityDictionary<T>[]
optionaloptions: NativeInsertUpdateManyOptions<T>
Returns Promise<QueryResult<T>>
reconnect
Closes all connections and re-establishes them.
Parameters
optionaloptions: { skipOnConnect?: boolean }
optionalskipOnConnect: boolean
Returns Promise<C>
setMetadata
Sets the metadata storage and initializes the comparator for all connections.
Parameters
metadata: MetadataStorage
Returns void
abstractstream
Returns an async iterator that streams query results one entity at a time.
Parameters
entityName: EntityName<T>
where: FilterQuery<T>
options: StreamOptions<T, never, *, never>
Returns AsyncIterableIterator<T, any, any>
syncCollections
Persists changes to M:N collections (inserts/deletes pivot table rows).
Parameters
collections: Iterable<Collection<T, O>, any, any>
optionaloptions: DriverMethodOptions
Returns Promise<void>
Abstract base class for all database drivers, implementing common driver logic.