Options
All
  • Public
  • Public/Protected
  • All
Menu

Class InsertQueryBuilder<Entity>

Allows to build complex sql queries in a fashion way and execute those queries.

Type parameters

  • Entity

Hierarchy

Index

Constructors

constructor

Properties

connection

connection: Connection

Connection on which QueryBuilder was created.

expressionMap

expressionMap: QueryExpressionMap

Contains all properties of the QueryBuilder that needs to be build a final query.

Protected Optional queryRunner

queryRunner: QueryRunner

Query runner used to execute query builder query.

Accessors

alias

  • get alias(): string

Methods

callListeners

  • callListeners(enabled: boolean): this

clone

  • clone(): this
  • Clones query builder as it is. Note: it uses new query runner, if you want query builder that uses exactly same query runner, you can create query builder using its constructor, for example new SelectQueryBuilder(queryBuilder) where queryBuilder is cloned QueryBuilder.

    Returns this

Protected computeWhereParameter

Protected createColumnNamesExpression

  • createColumnNamesExpression(): string

Protected createFromAlias

  • createFromAlias(entityTarget: Function | string | function, aliasName?: string): Alias

Protected createInsertExpression

  • createInsertExpression(): string

createQueryBuilder

  • createQueryBuilder(): this

Protected createReturningExpression

  • createReturningExpression(): string

Protected createValuesExpression

  • createValuesExpression(): string

Protected createWhereExpression

  • createWhereExpression(): string

Protected createWhereExpressionString

  • createWhereExpressionString(): string

Protected createWhereIdsExpression

  • createWhereIdsExpression(ids: any | any[]): string

delete

disableEscaping

  • disableEscaping(): this

escape

  • escape(name: string): string

execute

Protected getInsertedColumns

Protected getMainTableName

  • getMainTableName(): string

getParameters

getQuery

  • getQuery(): string

getQueryAndParameters

  • getQueryAndParameters(): [string, any[]]

Protected getReturningColumns

getSql

  • getSql(): string

Protected getTableName

  • getTableName(tablePath: string): string

Protected getValueSets

hasRelation

  • hasRelation<T>(target: ObjectType<T> | string, relation: string): boolean
  • hasRelation<T>(target: ObjectType<T> | string, relation: string[]): boolean
  • Checks if given relation exists in the entity. Returns true if relation exists, false otherwise.

    todo: move this method to manager? or create a shortcut?

    Type parameters

    • T

    Parameters

    Returns boolean

  • Checks if given relations exist in the entity. Returns true if relation exists, false otherwise.

    todo: move this method to manager? or create a shortcut?

    Type parameters

    • T

    Parameters

    • target: ObjectType<T> | string
    • relation: string[]

    Returns boolean

insert

into

Protected obtainQueryRunner

onConflict

  • onConflict(statement: string): this

orIgnore

  • orIgnore(statement?: string | boolean): this

orUpdate

  • orUpdate(statement?: object): this
  • Adds additional update statement supported in databases.

    Parameters

    • Optional statement: object
      • Optional columns?: string[]
      • Optional conflict_target?: string | string[]
      • Optional overwrite?: string[]

    Returns this

output

  • output(columns: string[]): this
  • output(output: string): this
  • output(output: string | string[]): this

printSql

  • printSql(): this

relation

Protected replacePropertyNames

  • replacePropertyNames(statement: string): string

returning

  • returning(columns: string[]): this
  • returning(returning: string): this
  • returning(returning: string | string[]): this

select

setNativeParameters

setParameter

  • setParameter(key: string, value: any): this

setParameters

setQueryRunner

update

updateEntity

  • updateEntity(enabled: boolean): this
  • Indicates if entity must be updated after insertion operations. This may produce extra query or use RETURNING / OUTPUT statement (depend on database). Enabled by default.

    Parameters

    • enabled: boolean

    Returns this

useTransaction

  • useTransaction(enabled: boolean): this

values

Generated using TypeDoc