Skip to main content
Version: 4.4

Class: DatabaseDriver<C>#

core.DatabaseDriver

Type parameters#

NameType
CConnection

Hierarchy#

Implements#

Constructors#

constructor#

+ Protectednew DatabaseDriver<C>(config: Configuration<IDatabaseDriver<Connection>>, dependencies: string[]): DatabaseDriver<C>

Type parameters:#

NameType
CConnection<C>

Parameters:#

NameType
configConfiguration<IDatabaseDriver<Connection>>
dependenciesstring[]

Returns: DatabaseDriver<C>

Defined in: packages/core/src/drivers/DatabaseDriver.ts:22

Properties#

__@EntityManagerType@43871#

__@EntityManagerType@43871: EntityManager<DatabaseDriver<C>>

Implementation of: IDatabaseDriver.__@EntityManagerType@43871

Defined in: packages/core/src/drivers/DatabaseDriver.ts:15


comparator#

Protected comparator: EntityComparator

Defined in: packages/core/src/drivers/DatabaseDriver.ts:21


config#

Protected Readonly config: Configuration<IDatabaseDriver<Connection>>


connection#

Protected Readonly connection: C

Defined in: packages/core/src/drivers/DatabaseDriver.ts:17


dependencies#

Protected Readonly dependencies: string[]


logger#

Protected Readonly logger: Logger

Defined in: packages/core/src/drivers/DatabaseDriver.ts:20


metadata#

Protected metadata: MetadataStorage

Defined in: packages/core/src/drivers/DatabaseDriver.ts:22


platform#

Protected Readonly platform: Platform

Defined in: packages/core/src/drivers/DatabaseDriver.ts:19


replicas#

Protected Readonly replicas: C[]

Defined in: packages/core/src/drivers/DatabaseDriver.ts:18

Methods#

aggregate#

aggregate(entityName: string, pipeline: any[]): Promise<any[]>

Parameters:#

NameType
entityNamestring
pipelineany[]

Returns: Promise<any[]>

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:49


close#

close(force?: boolean): Promise<void>

Parameters:#

NameType
force?boolean

Returns: Promise<void>

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:93


connect#

connect(): Promise<C>

Returns: Promise<C>

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:71


convertException#

convertException(exception: Error): DriverException

Converts native db errors to standardized driver exceptions

Parameters:#

NameType
exceptionError

Returns: DriverException

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:244


count#

Abstractcount<T>(entityName: string, where: FilterQuery<T>, options?: CountOptions<T>, ctx?: any): Promise<number>

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring
whereFilterQuery<T>
options?CountOptions<T>
ctx?any

Returns: Promise<number>

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:43


createEntityManager#

createEntityManager<D>(useContext?: boolean): D[typeof EntityManagerType]

Type parameters:#

NameTypeDefault
DIDatabaseDriver<Connection, D>IDatabaseDriver<Connection\>

Parameters:#

NameType
useContext?boolean

Returns: D[typeof EntityManagerType]

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:45


createReplicas#

ProtectedcreateReplicas(cb: (c: ConnectionOptions) => C): C[]

Parameters:#

NameType
cb(c: ConnectionOptions) => C

Returns: C[]

Defined in: packages/core/src/drivers/DatabaseDriver.ts:205


ensureIndexes#

ensureIndexes(): Promise<void>

Returns: Promise<void>

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:117


find#

Abstractfind<T>(entityName: string, where: FilterQuery<T>, options?: FindOptions<T, Populate<T>>, ctx?: any): Promise<EntityData<T>[]>

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring
whereFilterQuery<T>
options?FindOptions<T, Populate<T>>
ctx?any

Returns: Promise<EntityData<T>[]>

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:27


findOne#

AbstractfindOne<T>(entityName: string, where: FilterQuery<T>, options?: FindOneOptions<T, Populate<T>>, ctx?: any): Promise<null | EntityData<T>>

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring
whereFilterQuery<T>
options?FindOneOptions<T, Populate<T>>
ctx?any

Returns: Promise<null | EntityData<T>>

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:29


getConnection#

getConnection(type?: read | write): C

Parameters:#

NameTypeDefault value
typeread | write'write'

Returns: C

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:83


getDependencies#

getDependencies(): string[]

Returns: string[]

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:113


getPivotInverseProperty#

ProtectedgetPivotInverseProperty(prop: EntityProperty<any>): EntityProperty<any>

Parameters:#

NameType
propEntityProperty<any>

Returns: EntityProperty<any>

Defined in: packages/core/src/drivers/DatabaseDriver.ts:190


getPivotOrderBy#

ProtectedgetPivotOrderBy(prop: EntityProperty<any>, orderBy?: QueryOrderMap): QueryOrderMap

Parameters:#

NameType
propEntityProperty<any>
orderBy?QueryOrderMap

Returns: QueryOrderMap

Defined in: packages/core/src/drivers/DatabaseDriver.ts:169


getPlatform#

getPlatform(): Platform

Returns: Platform

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:98


getPrimaryKeyFields#

ProtectedgetPrimaryKeyFields(entityName: string): string[]

Parameters:#

NameType
entityNamestring

Returns: string[]

Defined in: packages/core/src/drivers/DatabaseDriver.ts:185


inlineEmbeddables#

ProtectedinlineEmbeddables<T>(meta: EntityMetadata<T>, data: T, where?: boolean): void

Type parameters:#

Name
T

Parameters:#

NameType
metaEntityMetadata<T>
dataT
where?boolean

Returns: void

Defined in: packages/core/src/drivers/DatabaseDriver.ts:121


loadFromPivotTable#

loadFromPivotTable<T, O>(prop: EntityProperty<any>, owners: Primary<O>[][], where?: { __@PrimaryKeyType@41543?: any } | NonNullable<Query<T>>, orderBy?: QueryOrderMap, ctx?: any, options?: FindOptions<T, Populate<T>>): Promise<Dictionary<T[]>>

Type parameters:#

NameType
TAnyEntity<T>
OAnyEntity<O>

Parameters:#

NameType
propEntityProperty<any>
ownersPrimary<O>[][]
where?{ __@PrimaryKeyType@41543?: any } | NonNullable<Query<T>>
orderBy?QueryOrderMap
ctx?any
options?FindOptions<T, Populate<T>>

Returns: Promise<Dictionary<T[]>>

Defined in: packages/core/src/drivers/DatabaseDriver.ts:53


lockPessimistic#

lockPessimistic<T>(entity: T, mode: LockMode, ctx?: any): Promise<void>

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityT
modeLockMode
ctx?any

Returns: Promise<void>

Defined in: packages/core/src/drivers/DatabaseDriver.ts:218


mapResult#

mapResult<T>(result: EntityData<T>, meta: EntityMetadata<T>, populate?: PopulateOptions<T>[]): null | EntityData<T>

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameTypeDefault value
resultEntityData<T>-
metaEntityMetadata<T>-
populatePopulateOptions<T>[]...

Returns: null | EntityData<T>

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:63


nativeDelete#

AbstractnativeDelete<T>(entityName: string, where: FilterQuery<T>, ctx?: any): Promise<QueryResult>

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring
whereFilterQuery<T>
ctx?any

Returns: Promise<QueryResult>

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:41


nativeInsert#

AbstractnativeInsert<T>(entityName: string, data: EntityData<T>, ctx?: any, convertCustomTypes?: boolean): Promise<QueryResult>

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring
dataEntityData<T>
ctx?any
convertCustomTypes?boolean

Returns: Promise<QueryResult>

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:31


nativeInsertMany#

AbstractnativeInsertMany<T>(entityName: string, data: EntityData<T>[], ctx?: any, processCollections?: boolean, convertCustomTypes?: boolean): Promise<QueryResult>

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring
dataEntityData<T>[]
ctx?any
processCollections?boolean
convertCustomTypes?boolean

Returns: Promise<QueryResult>

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:33


nativeUpdate#

AbstractnativeUpdate<T>(entityName: string, where: FilterQuery<T>, data: EntityData<T>, ctx?: any, convertCustomTypes?: boolean): Promise<QueryResult>

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring
whereFilterQuery<T>
dataEntityData<T>
ctx?any
convertCustomTypes?boolean

Returns: Promise<QueryResult>

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:35


nativeUpdateMany#

nativeUpdateMany<T>(entityName: string, where: FilterQuery<T>[], data: EntityData<T>[], ctx?: any, processCollections?: boolean, convertCustomTypes?: boolean): Promise<QueryResult>

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring
whereFilterQuery<T>[]
dataEntityData<T>[]
ctx?any
processCollections?boolean
convertCustomTypes?boolean

Returns: Promise<QueryResult>

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:37


reconnect#

reconnect(): Promise<C>

Returns: Promise<C>

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:78


rethrow#

Protectedrethrow<T>(promise: Promise<T>): Promise<T>

Type parameters:#

Name
T

Parameters:#

NameType
promisePromise<T>

Returns: Promise<T>

Defined in: packages/core/src/drivers/DatabaseDriver.ts:252


setMetadata#

setMetadata(metadata: MetadataStorage): void

Parameters:#

NameType
metadataMetadataStorage

Returns: void

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:102


shouldHaveColumn#

shouldHaveColumn<T>(prop: EntityProperty<T>, populate: PopulateOptions<T>[], includeFormulas?: boolean): boolean

internal

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameTypeDefault value
propEntityProperty<T>-
populatePopulateOptions<T>[]-
includeFormulasbooleantrue

Returns: boolean

Defined in: packages/core/src/drivers/DatabaseDriver.ts:225


syncCollection#

syncCollection<T, O>(coll: Collection<T, O>, ctx?: any): Promise<void>

Type parameters:#

NameType
TAnyEntity<T>
OAnyEntity<O>

Parameters:#

NameType
collCollection<T, O>
ctx?any

Returns: Promise<void>

Implementation of: IDatabaseDriver

Defined in: packages/core/src/drivers/DatabaseDriver.ts:57

Last updated on by renovate[bot]