Skip to main content
Version: Next

abstractAbstractSqlDriver <Connection, Platform>

Hierarchy

Index

Properties

[EntityManagerType]

[EntityManagerType]: SqlEntityManager<AbstractSqlDriver<Connection, Platform>>

readonlyconfig

Methods

aggregate

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

    • entityName: string
    • pipeline: any[]

    Returns Promise<any[]>

close

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

    • optionalforce: boolean

    Returns Promise<void>

connect

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

convertException

  • Converts native db errors to standardized driver exceptions


    Parameters

    • exception: Error

    Returns DriverException

count

  • count<T>(entityName: string, where: any, options?: CountOptions<T, never>): Promise<number>
  • Type parameters

    • T: object

    Parameters

    • entityName: string
    • where: any
    • options: CountOptions<T, never> = {}

    Returns Promise<number>

countVirtual

  • Type parameters

    • T: object

    Parameters

    Returns Promise<number>

createEntityManager

execute

  • execute<T>(queryOrKnex: string | QueryBuilder<any, any> | Raw<any>, params?: any[], method?: get | all | run, ctx?: any, loggerContext?: LoggingOptions): Promise<T>
  • Type parameters

    Parameters

    • queryOrKnex: string | QueryBuilder<any, any> | Raw<any>
    • params: any[] = []
    • method: get | all | run = 'all'
    • optionalctx: any
    • optionalloggerContext: LoggingOptions

    Returns Promise<T>

find

  • Finds selection of entities


    Type parameters

    • T: object
    • P: string = never
    • F: string = ALL
    • E: string = never

    Parameters

    Returns Promise<EntityData<T>[]>

findOne

  • Finds single entity (table row, document)


    Type parameters

    • T: object
    • P: string = never
    • F: string = ALL
    • E: string = never

    Parameters

    Returns Promise<null | EntityData<T>>

findVirtual

  • Type parameters

    • T: object

    Parameters

    Returns Promise<EntityData<T>[]>

getConnection

  • Parameters

    Returns Connection

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

  • getPlatform(): Platform
  • Returns Platform

loadFromPivotTable

  • loadFromPivotTable<T, O>(prop: EntityProperty<any, any>, owners: (O extends { [PrimaryKeyProp]?: PK } ? PK extends keyof O ? ReadonlyPrimary<UnwrapPrimary<O[PK]>> : PK extends keyof O[] ? ReadonlyPrimary<PrimaryPropToType<O, PK>> : PK : O extends { _id?: PK } ? string | ReadonlyPrimary<PK> : O extends { uuid?: PK } ? ReadonlyPrimary<PK> : O extends { id?: PK } ? ReadonlyPrimary<PK> : O)[][], where?: any, orderBy?: OrderDefinition<T>, ctx?: any, options?: FindOptions<T, any, any, any>, pivotJoin?: boolean): Promise<Dictionary<T[]>>
  • When driver uses pivot tables for M:N, this method will load identifiers for given collections from them


    Type parameters

    • T: object
    • O: object

    Parameters

    • prop: EntityProperty<any, any>
    • owners: (O extends { [PrimaryKeyProp]?: PK } ? PK extends keyof O ? ReadonlyPrimary<UnwrapPrimary<O[PK]>> : PK extends keyof O[] ? ReadonlyPrimary<PrimaryPropToType<O, PK>> : PK : O extends { _id?: PK } ? string | ReadonlyPrimary<PK> : O extends { uuid?: PK } ? ReadonlyPrimary<PK> : O extends { id?: PK } ? ReadonlyPrimary<PK> : O)[][]
    • where: any = ...
    • optionalorderBy: OrderDefinition<T>
    • optionalctx: any
    • optionaloptions: FindOptions<T, any, any, any>
    • optionalpivotJoin: boolean

    Returns Promise<Dictionary<T[]>>

lockPessimistic

  • lockPessimistic<T>(entity: T, options: LockOptions): Promise<void>
  • Type parameters

    • T: object

    Parameters

    Returns Promise<void>

mapResult

nativeDelete

  • Type parameters

    • T: object

    Parameters

    Returns Promise<QueryResult<T>>

nativeInsert

nativeInsertMany

nativeUpdate

nativeUpdateMany

reconnect

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

setMetadata

  • Parameters

    Returns void

syncCollections

  • Type parameters

    • T: object
    • O: object

    Parameters

    Returns Promise<void>