Skip to main content
Version: 6.1

MySqlDriver

Hierarchy

Index

Constructors

constructor

Properties

[EntityManagerType]

[EntityManagerType]: SqlEntityManager<MySqlDriver>

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

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 = *
    • E: string = never

    Parameters

    Returns Promise<EntityData<T>[]>

findOne

  • Finds single entity (table row, document)


    Type parameters

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

    Parameters

    Returns Promise<null | EntityData<T>>

findVirtual

  • Type parameters

    • T: object

    Parameters

    Returns Promise<EntityData<T>[]>

getConnection

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

  • Returns MySqlPlatform

loadFromPivotTable

  • 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

    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

setMetadata

  • Parameters

    Returns void

syncCollections

  • Type parameters

    • T: object
    • O: object

    Parameters

    Returns Promise<void>