Skip to main content
Version: 4.5

Interface: IDatabaseDriver<C>#

core.IDatabaseDriver

Type parameters#

NameTypeDefault
CConnectionConnection

Implemented by#

Properties#

[EntityManagerType]#

[EntityManagerType]: EntityManager<IDatabaseDriver<C>>

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:14

Methods#

aggregate#

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

Parameters:#

NameType
entityNamestring
pipelineany[]

Returns: Promise<any[]>

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:50


close#

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

Parameters:#

NameType
force?boolean

Returns: Promise<void>

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


connect#

connect(): Promise<C>

Returns: Promise<C>

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


convertException#

convertException(exception: Error): DriverException

Converts native db errors to standardized driver exceptions

Parameters:#

NameType
exceptionError

Returns: DriverException

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:76


count#

count<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>

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:48


createEntityManager#

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

Type parameters:#

NameTypeDefault
DIDatabaseDriver<Connection, D>IDatabaseDriver<Connection>

Parameters:#

NameType
useContext?boolean

Returns: D[typeof EntityManagerType]

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:16


ensureIndexes#

ensureIndexes(): Promise<void>

Returns: Promise<void>

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


find#

find<T>(entityName: string, where: FilterQuery<T>, options?: FindOptions<T, readonly string[] | readonly keyof T[] | boolean | LoadStrategy | PopulateChildren<T>>, ctx?: any): Promise<EntityData<T>[]>

Finds selection of entities

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring
whereFilterQuery<T>
options?FindOptions<T, readonly string[] | readonly keyof T[] | boolean | LoadStrategy | PopulateChildren<T>>
ctx?any

Returns: Promise<EntityData<T>[]>

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


findOne#

findOne<T>(entityName: string, where: FilterQuery<T>, options?: FindOneOptions<T, readonly string[] | readonly keyof T[] | boolean | LoadStrategy | PopulateChildren<T>>, ctx?: any): Promise<null | EntityData<T>>

Finds single entity (table row, document)

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
entityNamestring
whereFilterQuery<T>
options?FindOneOptions<T, readonly string[] | readonly keyof T[] | boolean | LoadStrategy | PopulateChildren<T>>
ctx?any

Returns: Promise<null | EntityData<T>>

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:34


getConnection#

getConnection(type?: read | write): C

Parameters:#

NameType
type?read | write

Returns: C

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:24


getDependencies#

getDependencies(): string[]

Returns name of the underlying database dependencies (e.g. mongodb or mysql2) for SQL drivers it also returns knex in the array as connectors are not used directly there

Returns: string[]

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:69


getPlatform#

getPlatform(): Platform

Returns: Platform

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:59


loadFromPivotTable#

loadFromPivotTable<T, O>(prop: EntityProperty<any>, owners: Primary<O>[][], where?: FilterQuery<T>, orderBy?: QueryOrderMap, ctx?: any, options?: FindOptions<T, readonly string[] | readonly keyof T[] | boolean | LoadStrategy | PopulateChildren<T>>): Promise<Dictionary<T[]>>

When driver uses pivot tables for M:N, this method will load identifiers for given collections from them

Type parameters:#

NameType
TAnyEntity<T>
OAnyEntity<O>

Parameters:#

NameType
propEntityProperty<any>
ownersPrimary<O>[][]
where?FilterQuery<T>
orderBy?QueryOrderMap
ctx?any
options?FindOptions<T, readonly string[] | readonly keyof T[] | boolean | LoadStrategy | PopulateChildren<T>>

Returns: Promise<Dictionary<T[]>>

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


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/IDatabaseDriver.ts:71


mapResult#

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

Type parameters:#

NameType
TAnyEntity<T>

Parameters:#

NameType
resultEntityData<T>
metaEntityMetadata<any>
populate?PopulateOptions<T>[]

Returns: null | EntityData<T>

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:52


nativeDelete#

nativeDelete<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>

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:44


nativeInsert#

nativeInsert<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>

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:36


nativeInsertMany#

nativeInsertMany<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>

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:38


nativeUpdate#

nativeUpdate<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>

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:40


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>

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:42


reconnect#

reconnect(): Promise<C>

Returns: Promise<C>

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


setMetadata#

setMetadata(metadata: MetadataStorage): void

Parameters:#

NameType
metadataMetadataStorage

Returns: void

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:61


syncCollection#

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

Type parameters:#

Name
T
O

Parameters:#

NameType
collectionCollection<T, O>
ctx?any

Returns: Promise<void>

Defined in: packages/core/src/drivers/IDatabaseDriver.ts:46

Last updated on by Renovate Bot