Options
All
  • Public
  • Public/Protected
  • All
Menu

Class CockroachDriver

Organizes communication with Cockroach DBMS.

Hierarchy

  • CockroachDriver

Implements

Index

Constructors

constructor

Properties

connectedQueryRunners

connectedQueryRunners: QueryRunner[] = []

We store all created query runners because we need to release them.

connection

connection: Connection

Connection used by driver.

Optional database

database: string

Master database used to perform all write queries.

isReplicated

isReplicated: boolean = false

Indicates if replication is enabled.

master

master: any

Pool for master database.

Optional maxAliasLength

maxAliasLength: number

No documentation specifying a maximum length for identifiers could be found for CockroarchDb.

options

Connection options.

postgres

postgres: any

Cockroach underlying library.

slaves

slaves: any[] = []

Pool for slave databases. Used in replication.

spatialTypes

spatialTypes: ColumnType[] = []

Gets list of spatial column data types.

supportedDataTypes

supportedDataTypes: ColumnType[] = ["array","bool","boolean","bytes","bytea","blob","date","numeric","decimal","dec","float","float4","float8","double precision","real","inet","int","int4","integer","int2","int8","int64","smallint","bigint","interval","string","character varying","character","char","char varying","varchar","text","time","time without time zone","timestamp","timestamptz","timestamp without time zone","timestamp with time zone","json","jsonb","uuid",]

Gets list of supported column data types by a driver.

see

https://www.cockroachlabs.com/docs/stable/data-types.html

treeSupport

treeSupport: boolean = true

Indicates if tree tables are supported by this driver.

withLengthColumnTypes

withLengthColumnTypes: ColumnType[] = ["character varying","char varying","varchar","character","char","string",]

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

withPrecisionColumnTypes

withPrecisionColumnTypes: ColumnType[] = ["numeric","decimal","dec",]

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

withScaleColumnTypes

withScaleColumnTypes: ColumnType[] = ["numeric","decimal","dec"]

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

Methods

afterConnect

  • afterConnect(): Promise<void>

buildTableName

  • buildTableName(tableName: string, schema?: string): string

Protected closePool

  • closePool(pool: any): Promise<void>

connect

  • connect(): Promise<void>
  • Performs connection to the database. Based on pooling options, it can either create connection immediately, either create a pool and create connection when needed.

    Returns Promise<void>

createFullType

createGeneratedMap

createParameter

  • createParameter(parameterName: string, index: number): string

Protected createPool

createQueryRunner

createSchemaBuilder

disconnect

  • disconnect(): Promise<void>

escape

  • escape(columnName: string): string

escapeQueryWithParameters

Protected executeQuery

  • executeQuery(connection: any, query: string): any

findChangedColumns

getColumnLength

isReturningSqlSupported

  • isReturningSqlSupported(): boolean

isUUIDGenerationSupported

  • isUUIDGenerationSupported(): boolean

Protected loadDependencies

  • loadDependencies(): void

loadStreamDependency

  • loadStreamDependency(): any

Private lowerDefaultValueIfNecessary

  • lowerDefaultValueIfNecessary(value: string | undefined): string

normalizeDefault

normalizeIsUnique

normalizeType

  • normalizeType(column: object): string
  • Creates a database type from a given column metadata.

    Parameters

    • column: object
      • Optional generationStrategy?: "increment" | "uuid" | "rowid"
      • Optional isArray?: boolean
      • Optional isGenerated?: boolean
      • Optional length?: number | string
      • Optional precision?: number | null
      • Optional scale?: number
      • Optional type?: ColumnType

    Returns string

obtainMasterConnection

  • obtainMasterConnection(): Promise<any>

obtainSlaveConnection

  • obtainSlaveConnection(): Promise<any>

prepareHydratedValue

  • prepareHydratedValue(value: any, columnMetadata: ColumnMetadata): any

preparePersistentValue

  • preparePersistentValue(value: any, columnMetadata: ColumnMetadata): any

Object literals

dataTypeDefaults

dataTypeDefaults: object

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.

char

char: object

length

length: number = 1

mappedDataTypes

mappedDataTypes: object

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

cacheDuration

cacheDuration: NumberConstructor = Number

cacheId

cacheId: NumberConstructor = Number

cacheIdentifier

cacheIdentifier: "varchar" = "varchar"

cacheQuery

cacheQuery: "string" = "string"

cacheResult

cacheResult: "string" = "string"

cacheTime

cacheTime: "int8" = "int8"

createDate

createDate: "timestamptz" = "timestamptz"

createDateDefault

createDateDefault: string = "now()"

metadataDatabase

metadataDatabase: "varchar" = "varchar"

metadataName

metadataName: "varchar" = "varchar"

metadataSchema

metadataSchema: "varchar" = "varchar"

metadataTable

metadataTable: "varchar" = "varchar"

metadataType

metadataType: "varchar" = "varchar"

metadataValue

metadataValue: "string" = "string"

migrationId

migrationId: NumberConstructor = Number

migrationName

migrationName: "varchar" = "varchar"

migrationTimestamp

migrationTimestamp: "int8" = "int8"

treeLevel

treeLevel: NumberConstructor = Number

updateDate

updateDate: "timestamptz" = "timestamptz"

updateDateDefault

updateDateDefault: string = "now()"

version

version: NumberConstructor = Number

Generated using TypeDoc