Options
All
  • Public
  • Public/Protected
  • All
Menu

Interface Driver

Driver organizes TypeORM communication with specific database management system.

Hierarchy

  • Driver

Implemented by

Index

Properties

dataTypeDefaults

dataTypeDefaults: DataTypeDefaults

Default values of length, precision and scale depends on column data type. Used in the cases when length/precision/scale is not specified by user.

Optional database

database: string

Master database used to perform all write queries.

todo: probably move into query runner.

isReplicated

isReplicated: boolean

Indicates if replication is enabled.

mappedDataTypes

mappedDataTypes: MappedColumnTypes

Orm has special columns and we need to know what database column types should be for those types. Column types are driver dependant.

Optional maxAliasLength

maxAliasLength: number

Max length allowed by the DBMS for aliases (execution of queries).

options

Connection options.

spatialTypes

spatialTypes: ColumnType[]

Gets list of spatial column data types.

supportedDataTypes

supportedDataTypes: ColumnType[]

Gets list of supported column data types by a driver.

treeSupport

treeSupport: boolean

Indicates if tree tables are supported by this driver.

withLengthColumnTypes

withLengthColumnTypes: ColumnType[]

Gets list of column data types that support length by a driver.

withPrecisionColumnTypes

withPrecisionColumnTypes: ColumnType[]

Gets list of column data types that support precision by a driver.

withScaleColumnTypes

withScaleColumnTypes: ColumnType[]

Gets list of column data types that support scale by a driver.

Methods

afterConnect

  • afterConnect(): Promise<void>
  • Makes any action after connection (e.g. create extensions in Postgres driver).

    Returns Promise<void>

buildTableName

  • buildTableName(tableName: string, schema?: string, database?: string): string
  • Build full table name with database name, schema name and table name. E.g. "myDB"."mySchema"."myTable"

    Parameters

    • tableName: string
    • Optional schema: string
    • Optional database: string

    Returns string

connect

  • connect(): Promise<void>
  • Performs connection to the database. Depend on driver type it may create a connection pool.

    Returns Promise<void>

createFullType

createGeneratedMap

createParameter

  • createParameter(parameterName: string, index: number): string
  • Creates an escaped parameter.

    Parameters

    • parameterName: string
    • index: number

    Returns string

createQueryRunner

  • createQueryRunner(mode: "master" | "slave"): QueryRunner

createSchemaBuilder

disconnect

  • disconnect(): Promise<void>
  • Closes connection with database and releases all resources.

    Returns Promise<void>

escape

  • escape(name: string): string
  • Escapes a table name, column name or an alias.

    todo: probably escape should be able to handle dots in the names and automatically escape them

    Parameters

    • name: string

    Returns string

escapeQueryWithParameters

  • Replaces parameters in the given sql with special escaping character and an array of parameter names to be passed to a query.

    Parameters

    Returns [string, any[]]

findChangedColumns

getColumnLength

isReturningSqlSupported

  • isReturningSqlSupported(): boolean
  • Returns true if driver supports RETURNING / OUTPUT statement.

    Returns boolean

isUUIDGenerationSupported

  • isUUIDGenerationSupported(): boolean
  • Returns true if driver supports uuid values generation on its own.

    Returns boolean

normalizeDefault

normalizeIsUnique

normalizeType

  • normalizeType(column: object): string
  • Transforms type of the given column to a database column type.

    Parameters

    • column: object
      • Optional isArray?: boolean
      • Optional length?: number | string
      • Optional precision?: number | null
      • Optional scale?: number
      • Optional type?: ColumnType | string

    Returns string

obtainMasterConnection

  • obtainMasterConnection(): Promise<any>
  • Obtains a new database connection to a master server. Used for replication. If replication is not setup then returns default connection's database connection.

    Returns Promise<any>

obtainSlaveConnection

  • obtainSlaveConnection(): Promise<any>
  • Obtains a new database connection to a slave server. Used for replication. If replication is not setup then returns master (default) connection's database connection.

    Returns Promise<any>

prepareHydratedValue

preparePersistentValue

  • Prepares given value to a value to be persisted, based on its column type and metadata.

    Parameters

    Returns any

Generated using TypeDoc