Skip to main content
Version: 6.4

IDatabaseDriver <C>

Implemented by

Index

Properties

[EntityManagerType]

[EntityManagerType]: EntityManager<IDatabaseDriver<C>>

readonlyconfig

Methods

aggregate

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

    • entityName: string
    • pipeline: any[]

    Returns Promise<any[]>

close

  • close(force): Promise<void>
  • Parameters

    • optionalforce: boolean

    Returns Promise<void>

connect

  • connect(): Promise<C>
  • Returns Promise<C>

convertException

  • Converts native db errors to standardized driver exceptions


    Parameters

    • exception: Error

    Returns DriverException

count

  • count(entityName, where, options): Promise<number>

createEntityManager

find

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

findOne

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

findVirtual

  • findVirtual(entityName, where, options): Promise<EntityData<T>[]>

getConnection

  • getConnection(type): C

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

getMetadata

getPlatform

loadFromPivotTable

  • loadFromPivotTable(prop, owners, where, orderBy, ctx, options, pivotJoin): Promise<Dictionary<T[]>>
  • 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 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 { uuid?: PK } ? ReadonlyPrimary<PK> : O extends { id?: PK } ? ReadonlyPrimary<PK> : O)[][]
    • optionalwhere: FilterQuery<T>
    • optionalorderBy: OrderDefinition<T>
    • optionalctx: any
    • optionaloptions: FindOptions<T, any, any, any>
    • optionalpivotJoin: boolean

    Returns Promise<Dictionary<T[]>>

lockPessimistic

  • lockPessimistic(entity, options): Promise<void>
  • Parameters

    Returns Promise<void>

mapResult

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

nativeDelete

  • nativeDelete(entityName, where, options): Promise<QueryResult<T>>

nativeInsert

  • nativeInsert(entityName, data, options): Promise<QueryResult<T>>

nativeInsertMany

  • nativeInsertMany(entityName, data, options, transform): Promise<QueryResult<T>>

nativeUpdate

  • nativeUpdate(entityName, where, data, options): Promise<QueryResult<T>>

nativeUpdateMany

  • nativeUpdateMany(entityName, where, data, options): Promise<QueryResult<T>>

reconnect

  • reconnect(): Promise<C>
  • Returns Promise<C>

setMetadata

  • setMetadata(metadata): void

syncCollections

  • syncCollections(collections, options): Promise<void>