Version: 4.3

Class: DatabaseDriver<C>

Type parameters

NameType
CConnection

Hierarchy

  • DatabaseDriver

Implements

Constructors

constructor

+ Protectednew DatabaseDriver(config: Configuration, dependencies: string[]): DatabaseDriver

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

Parameters:

NameType
configConfiguration
dependenciesstring[]

Returns: DatabaseDriver

Properties

[EntityManagerType]

[EntityManagerType]: EntityManager<this>

Implementation of IDatabaseDriver.[EntityManagerType]

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

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


connection

Protected Readonly connection: C

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


dependencies

Protected Readonly dependencies: string[]

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


logger

Protected Readonly logger: Logger = this.config.getLogger()

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[]>

Implementation of IDatabaseDriver

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

Parameters:

NameType
entityNamestring
pipelineany[]

Returns: Promise<any[]>


close

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

Implementation of IDatabaseDriver

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

Parameters:

NameType
force?boolean

Returns: Promise<void>


connect

connect(): Promise<C>

Implementation of IDatabaseDriver

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

Returns: Promise<C>


convertException

convertException(exception: Error): DriverException

Implementation of IDatabaseDriver

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

Converts native db errors to standardized driver exceptions

Parameters:

NameType
exceptionError

Returns: DriverException


count

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

Implementation of IDatabaseDriver

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

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

Returns: Promise<number>


createEntityManager

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

Implementation of IDatabaseDriver

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

Type parameters:

NameTypeDefault
DIDatabaseDriverIDatabaseDriver

Parameters:

NameType
useContext?boolean

Returns: D[typeof EntityManagerType]


createReplicas

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

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

Parameters:

NameType
cb(c: ConnectionOptions) => C

Returns: C[]


ensureIndexes

ensureIndexes(): Promise<void>

Implementation of IDatabaseDriver

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

Returns: Promise<void>


find

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

Implementation of IDatabaseDriver

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
entityNamestring
whereFilterQuery<T>
options?FindOptions<T>
ctx?Transaction

Returns: Promise<EntityData<T>[]>


findOne

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

Implementation of IDatabaseDriver

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
entityNamestring
whereFilterQuery<T>
options?FindOneOptions<T>
ctx?Transaction

Returns: Promise<EntityData<T> | null>


getConnection

getConnection(type?: "read" | "write"): C

Implementation of IDatabaseDriver

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

Parameters:

NameTypeDefault value
type"read" | "write""write"

Returns: C


getDependencies

getDependencies(): string[]

Implementation of IDatabaseDriver

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

Returns: string[]


getPivotInverseProperty

ProtectedgetPivotInverseProperty(prop: EntityProperty): EntityProperty

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

Parameters:

NameType
propEntityProperty

Returns: EntityProperty


getPivotOrderBy

ProtectedgetPivotOrderBy(prop: EntityProperty, orderBy?: QueryOrderMap): QueryOrderMap

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

Parameters:

NameType
propEntityProperty
orderBy?QueryOrderMap

Returns: QueryOrderMap


getPlatform

getPlatform(): Platform

Implementation of IDatabaseDriver

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

Returns: Platform


getPrimaryKeyFields

ProtectedgetPrimaryKeyFields(entityName: string): string[]

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

Parameters:

NameType
entityNamestring

Returns: string[]


inlineEmbeddables

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

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

Type parameters:

Name
T

Parameters:

NameType
metaEntityMetadata<T>
dataT
where?boolean

Returns: void


loadFromPivotTable

loadFromPivotTable<T, O>(prop: EntityProperty, owners: Primary<O>[][], where?: FilterQuery<T>, orderBy?: QueryOrderMap, ctx?: Transaction): Promise<Dictionary<T[]>>

Implementation of IDatabaseDriver

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

Type parameters:

NameType
TAnyEntity<T>
OAnyEntity<O>

Parameters:

NameType
propEntityProperty
ownersPrimary<O>[][]
where?FilterQuery<T>
orderBy?QueryOrderMap
ctx?Transaction

Returns: Promise<Dictionary<T[]>>


lockPessimistic

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

Implementation of IDatabaseDriver

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
entityT
modeLockMode
ctx?Transaction

Returns: Promise<void>


mapResult

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

Implementation of IDatabaseDriver

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

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

Returns: EntityData<T> | null


nativeDelete

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

Implementation of IDatabaseDriver

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

NameType
entityNamestring
whereFilterQuery<T>
ctx?Transaction

Returns: Promise<QueryResult>


nativeInsert

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

Implementation of IDatabaseDriver

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

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

Returns: Promise<QueryResult>


nativeInsertMany

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

Implementation of IDatabaseDriver

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

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

Returns: Promise<QueryResult>


nativeUpdate

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

Implementation of IDatabaseDriver

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

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

Returns: Promise<QueryResult>


nativeUpdateMany

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

Implementation of IDatabaseDriver

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

Type parameters:

NameType
TAnyEntity<T>

Parameters:

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

Returns: Promise<QueryResult>


reconnect

reconnect(): Promise<C>

Implementation of IDatabaseDriver

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

Returns: Promise<C>


rethrow

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

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

Type parameters:

Name
T

Parameters:

NameType
promisePromise<T>

Returns: Promise<T>


setMetadata

setMetadata(metadata: MetadataStorage): void

Implementation of IDatabaseDriver

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

Parameters:

NameType
metadataMetadataStorage

Returns: void


shouldHaveColumn

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

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

internal

Type parameters:

NameType
TAnyEntity<T>

Parameters:

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

Returns: boolean


syncCollection

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

Implementation of IDatabaseDriver

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

Type parameters:

NameType
TAnyEntity<T>
OAnyEntity<O>

Parameters:

NameType
collCollection<T, O>
ctx?Transaction

Returns: Promise<void>

Last updated on by Martin Adámek