Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PostgresQueryRunner

Runs queries on a single postgres database connection.

Hierarchy

Implements

Index

Constructors

Properties

Methods

Constructors

constructor

Properties

broadcaster

broadcaster: Broadcaster

Broadcaster used on this query runner to broadcast entity events.

connection

connection: Connection

Connection used by this query runner.

data

data: object

Stores temporarily user data. Useful for sharing data with subscribers.

Type declaration

Protected databaseConnection

databaseConnection: any

Real database connection from a connection pool used to perform queries.

Protected databaseConnectionPromise

databaseConnectionPromise: Promise<any>

Promise used to obtain a database connection for a first time.

driver

Database driver used by connection.

isReleased

isReleased: boolean = false

Indicates if connection for this query runner is released. Once its released, query runner cannot run queries anymore.

isTransactionActive

isTransactionActive: boolean = false

Indicates if transaction is in progress.

loadedTables

loadedTables: Table[] = []

All synchronized tables in the database.

loadedViews

loadedViews: View[] = []

All synchronized views in the database.

manager

manager: EntityManager

Entity manager working only with current query runner.

Protected mode

mode: "master" | "slave"

Mode in which query runner executes. Used for replication. If replication is not setup its value is ignored.

Protected releaseCallback

releaseCallback: Function

Special callback provided by a driver used to release a created connection.

Protected sqlInMemory

sqlInMemory: SqlInMemory = new SqlInMemory()

Sql-s stored if "sql in memory" mode is enabled.

Protected sqlMemoryMode

sqlMemoryMode: boolean = false

Indicates if special query runner mode in which sql queries won't be executed is enabled.

Methods

addColumn

addColumns

  • addColumns(tableOrName: Table | string, columns: TableColumn[]): Promise<void>

Protected buildCreateColumnSql

Protected buildEnumName

  • buildEnumName(table: Table, columnOrName: TableColumn | string, withSchema?: boolean, disableEscape?: boolean, toOld?: boolean): string

Protected buildSequenceName

  • buildSequenceName(table: Table, columnOrName: TableColumn | string, currentSchema?: string, disableEscape?: true, skipSchema?: boolean): string

changeColumn

changeColumns

  • changeColumns(tableOrName: Table | string, changedColumns: object[]): Promise<void>

clearDatabase

  • clearDatabase(): Promise<void>

clearSqlMemory

  • clearSqlMemory(): void

clearTable

  • clearTable(tableName: string): Promise<void>

commitTransaction

  • commitTransaction(): Promise<void>

connect

  • connect(): Promise<any>

createCheckConstraint

  • createCheckConstraint(tableOrName: Table | string, checkConstraint: TableCheck): Promise<void>

Protected createCheckConstraintSql

createCheckConstraints

  • createCheckConstraints(tableOrName: Table | string, checkConstraints: TableCheck[]): Promise<void>

createDatabase

  • createDatabase(database: string, ifNotExist?: boolean): Promise<void>

Protected createEnumTypeSql

createExclusionConstraint

  • createExclusionConstraint(tableOrName: Table | string, exclusionConstraint: TableExclusion): Promise<void>

Protected createExclusionConstraintSql

createExclusionConstraints

  • createExclusionConstraints(tableOrName: Table | string, exclusionConstraints: TableExclusion[]): Promise<void>

createForeignKey

Protected createForeignKeySql

createForeignKeys

createIndex

  • createIndex(tableOrName: Table | string, index: TableIndex): Promise<void>

Protected createIndexSql

createIndices

  • createIndices(tableOrName: Table | string, indices: TableIndex[]): Promise<void>

createPrimaryKey

  • createPrimaryKey(tableOrName: Table | string, columnNames: string[]): Promise<void>

Protected createPrimaryKeySql

  • createPrimaryKeySql(table: Table, columnNames: string[]): Query

createSchema

  • createSchema(schema: string, ifNotExist?: boolean): Promise<void>

createTable

  • createTable(table: Table, ifNotExist?: boolean, createForeignKeys?: boolean, createIndices?: boolean): Promise<void>

Protected createTableSql

  • createTableSql(table: Table, createForeignKeys?: boolean): Query

createUniqueConstraint

  • createUniqueConstraint(tableOrName: Table | string, uniqueConstraint: TableUnique): Promise<void>

Protected createUniqueConstraintSql

createUniqueConstraints

  • createUniqueConstraints(tableOrName: Table | string, uniqueConstraints: TableUnique[]): Promise<void>

createView

  • createView(view: View): Promise<void>

Protected createViewSql

Protected deleteViewDefinitionSql

  • deleteViewDefinitionSql(viewOrPath: View | string): Promise<Query>

disableSqlMemory

  • disableSqlMemory(): void

dropCheckConstraint

  • dropCheckConstraint(tableOrName: Table | string, checkOrName: TableCheck | string): Promise<void>

Protected dropCheckConstraintSql

dropCheckConstraints

  • dropCheckConstraints(tableOrName: Table | string, checkConstraints: TableCheck[]): Promise<void>

dropColumn

  • dropColumn(tableOrName: Table | string, columnOrName: TableColumn | string): Promise<void>

dropColumns

  • dropColumns(tableOrName: Table | string, columns: TableColumn[]): Promise<void>

dropDatabase

  • dropDatabase(database: string, ifExist?: boolean): Promise<void>

Protected dropEnumTypeSql

Protected dropEnumTypes

  • dropEnumTypes(schemaNames: string): Promise<void>

dropExclusionConstraint

  • dropExclusionConstraint(tableOrName: Table | string, exclusionOrName: TableExclusion | string): Promise<void>

Protected dropExclusionConstraintSql

dropExclusionConstraints

  • dropExclusionConstraints(tableOrName: Table | string, exclusionConstraints: TableExclusion[]): Promise<void>

dropForeignKey

  • dropForeignKey(tableOrName: Table | string, foreignKeyOrName: TableForeignKey | string): Promise<void>

Protected dropForeignKeySql

dropForeignKeys

dropIndex

  • dropIndex(tableOrName: Table | string, indexOrName: TableIndex | string): Promise<void>

Protected dropIndexSql

dropIndices

  • dropIndices(tableOrName: Table | string, indices: TableIndex[]): Promise<void>

dropPrimaryKey

  • dropPrimaryKey(tableOrName: Table | string): Promise<void>

Protected dropPrimaryKeySql

dropSchema

  • dropSchema(schemaPath: string, ifExist?: boolean, isCascade?: boolean): Promise<void>

dropTable

  • dropTable(target: Table | string, ifExist?: boolean, dropForeignKeys?: boolean, dropIndices?: boolean): Promise<void>

Protected dropTableSql

  • dropTableSql(tableOrPath: Table | string): Query

dropUniqueConstraint

  • dropUniqueConstraint(tableOrName: Table | string, uniqueOrName: TableUnique | string): Promise<void>

Protected dropUniqueConstraintSql

dropUniqueConstraints

  • dropUniqueConstraints(tableOrName: Table | string, uniqueConstraints: TableUnique[]): Promise<void>

dropView

  • dropView(target: View | string): Promise<void>

Protected dropViewSql

  • dropViewSql(viewOrPath: View | string): Query

enableSqlMemory

  • enableSqlMemory(): void

Protected escapePath

  • escapePath(target: Table | View | string, disableEscape?: boolean): string

executeMemoryDownSql

  • executeMemoryDownSql(): Promise<void>

executeMemoryUpSql

  • executeMemoryUpSql(): Promise<void>

Protected executeQueries

Protected extractSchema

  • extractSchema(target: Table | string): string | undefined

Protected getCachedTable

  • getCachedTable(tableName: string): Promise<Table>

Protected getCachedView

  • getCachedView(viewName: string): Promise<View>

getDatabases

  • getDatabases(): Promise<string[]>

Protected getEnumTypeName

getMemorySql

getSchemas

  • getSchemas(database?: string): Promise<string[]>

getTable

  • getTable(tablePath: string): Promise<Table | undefined>

getTables

  • getTables(tableNames: string[]): Promise<Table[]>

Protected getTypeormMetadataTableName

  • getTypeormMetadataTableName(): string

getView

  • getView(viewPath: string): Promise<View | undefined>

getViews

  • getViews(viewPaths: string[]): Promise<View[]>

hasColumn

  • hasColumn(tableOrName: Table | string, columnName: string): Promise<boolean>

hasDatabase

  • hasDatabase(database: string): Promise<boolean>

Protected hasEnumType

hasSchema

  • hasSchema(schema: string): Promise<boolean>

hasTable

  • hasTable(tableOrName: Table | string): Promise<boolean>

Protected insertViewDefinitionSql

  • insertViewDefinitionSql(view: View): Promise<Query>

Protected isColumnChanged

  • isColumnChanged(oldColumn: TableColumn, newColumn: TableColumn, checkDefault?: boolean, checkComment?: boolean): boolean

Protected isDefaultColumnLength

  • isDefaultColumnLength(table: Table, column: TableColumn, length: string): boolean

Protected isDefaultColumnPrecision

  • isDefaultColumnPrecision(table: Table, column: TableColumn, precision: number): boolean

Protected isDefaultColumnScale

  • isDefaultColumnScale(table: Table, column: TableColumn, scale: number): boolean

Protected isDefaultColumnWidth

  • isDefaultColumnWidth(table: Table, column: TableColumn, width: number): boolean

Protected loadTables

  • loadTables(tableNames: string[]): Promise<Table[]>

Protected loadViews

  • loadViews(viewNames: string[]): Promise<View[]>

Protected parseTableName

  • parseTableName(target: Table | string): object

query

  • query(query: string, parameters?: any[]): Promise<any>

release

  • release(): Promise<void>

renameColumn

  • renameColumn(tableOrName: Table | string, oldTableColumnOrName: TableColumn | string, newTableColumnOrName: TableColumn | string): Promise<void>

renameTable

  • renameTable(oldTableOrName: Table | string, newTableName: string): Promise<void>

Protected replaceCachedTable

  • replaceCachedTable(table: Table, changedTable: Table): void

rollbackTransaction

  • rollbackTransaction(): Promise<void>

startTransaction

stream

  • stream(query: string, parameters?: any[], onEnd?: Function, onError?: Function): Promise<ReadStream>

updatePrimaryKeys

  • updatePrimaryKeys(tableOrName: Table | string, columns: TableColumn[]): Promise<void>

Generated using TypeDoc