Skip to main content
Version: Next

Interface: IDatabaseDriver<C>

core.IDatabaseDriver

Type parameters#

NameType
CC: Connection = Connection

Implemented by#

Properties#

[EntityManagerType]#

[EntityManagerType]: EntityManager<IDatabaseDriver<C>>

Defined in#

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

Methods#

aggregate#

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

Parameters#

NameType
entityNamestring
pipelineany[]

Returns#

Promise<any[]>

Defined in#

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


clearCollection#

clearCollection<T, O>(collection, ctx?): 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:48


close#

close(force?): 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): DriverException

Converts native db errors to standardized driver exceptions

Parameters#

NameType
exceptionError

Returns#

DriverException

Defined in#

packages/core/src/drivers/IDatabaseDriver.ts:78


count#

count<T>(entityName, where, options?, ctx?): Promise<number>

Type parameters#

NameType
TT: AnyEntity<T>

Parameters#

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

Returns#

Promise<number>

Defined in#

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


createEntityManager#

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

Type parameters#

NameType
DD: IDatabaseDriver<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:65


find#

find<T>(entityName, where, options?, ctx?): Promise<EntityData<T>[]>

Finds selection of entities

Type parameters#

NameType
TT: AnyEntity<T>

Parameters#

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

Returns#

Promise<EntityData<T>[]>

Defined in#

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


findOne#

findOne<T>(entityName, where, options?, ctx?): Promise<null | EntityData<T>>

Finds single entity (table row, document)

Type parameters#

NameType
TT: AnyEntity<T>

Parameters#

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

Returns#

Promise<null | EntityData<T>>

Defined in#

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


getConnection#

getConnection(type?): 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:71


getPlatform#

getPlatform(): Platform

Returns#

Platform

Defined in#

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


loadFromPivotTable#

loadFromPivotTable<T, O>(prop, owners, where?, orderBy?, ctx?, options?): Promise<Dictionary<T[]>>

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

Type parameters#

NameType
TT: AnyEntity<T>
OO: AnyEntity<O>

Parameters#

NameType
propEntityProperty<any>
ownersPrimary<O>[][]
where?FilterQuery<T>
orderBy?QueryOrderMap
ctx?any
options?FindOptions<T, Populate<T>>

Returns#

Promise<Dictionary<T[]>>

Defined in#

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


lockPessimistic#

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

Type parameters#

NameType
TT: AnyEntity<T>

Parameters#

NameType
entityT
modeLockMode
tables?string[]
ctx?any

Returns#

Promise<void>

Defined in#

packages/core/src/drivers/IDatabaseDriver.ts:73


mapResult#

mapResult<T>(result, meta, populate?): null | EntityData<T>

Type parameters#

NameType
TT: AnyEntity<T>

Parameters#

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

Returns#

null | EntityData<T>

Defined in#

packages/core/src/drivers/IDatabaseDriver.ts:54


nativeDelete#

nativeDelete<T>(entityName, where, ctx?): Promise<QueryResult>

Type parameters#

NameType
TT: AnyEntity<T>

Parameters#

NameType
entityNamestring
whereFilterQuery<T>
ctx?any

Returns#

Promise<QueryResult>

Defined in#

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


nativeInsert#

nativeInsert<T>(entityName, data, ctx?, convertCustomTypes?): Promise<QueryResult>

Type parameters#

NameType
TT: AnyEntity<T>

Parameters#

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

Returns#

Promise<QueryResult>

Defined in#

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


nativeInsertMany#

nativeInsertMany<T>(entityName, data, ctx?, processCollections?, convertCustomTypes?): Promise<QueryResult>

Type parameters#

NameType
TT: AnyEntity<T>

Parameters#

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

Returns#

Promise<QueryResult>

Defined in#

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


nativeUpdate#

nativeUpdate<T>(entityName, where, data, ctx?, convertCustomTypes?): Promise<QueryResult>

Type parameters#

NameType
TT: AnyEntity<T>

Parameters#

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

Returns#

Promise<QueryResult>

Defined in#

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


nativeUpdateMany#

nativeUpdateMany<T>(entityName, where, data, ctx?, processCollections?, convertCustomTypes?): Promise<QueryResult>

Type parameters#

NameType
TT: AnyEntity<T>

Parameters#

NameType
entityNamestring
whereFilterQuery<T>[]
dataEntityDictionary<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): void

Parameters#

NameType
metadataMetadataStorage

Returns#

void

Defined in#

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


syncCollection#

syncCollection<T, O>(collection, ctx?): 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