Options
All
  • Public
  • Public/Protected
  • All
Menu

Class UpdateQueryBuilder<Entity>

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

Type parameters

  • Entity

Hierarchy

Implements

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

addOrderBy

  • addOrderBy(sort: string, order?: "ASC" | "DESC", nulls?: "NULLS FIRST" | "NULLS LAST"): this
  • Adds ORDER BY condition in the query builder.

    Parameters

    • sort: string
    • Default value order: "ASC" | "DESC" = "ASC"
    • Optional nulls: "NULLS FIRST" | "NULLS LAST"

    Returns this

andWhere

andWhereInIds

  • andWhereInIds(ids: any | any[]): this

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 createFromAlias

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

Protected createLimitExpression

  • createLimitExpression(): string

Protected createOrderByExpression

  • createOrderByExpression(): string

createQueryBuilder

  • createQueryBuilder(): this

Protected createReturningExpression

  • createReturningExpression(): string

Protected createUpdateExpression

  • createUpdateExpression(): 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 getMainTableName

  • getMainTableName(): string

getParameters

getQuery

  • getQuery(): string

getQueryAndParameters

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

Protected getReturningColumns

getSql

  • getSql(): string

Protected getTableName

  • getTableName(tablePath: string): string

Protected getValueSet

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

limit

  • limit(limit?: number): this

Protected obtainQueryRunner

orWhere

orWhereInIds

  • orWhereInIds(ids: any | any[]): this

orderBy

  • orderBy(): this
  • orderBy(sort: string, order?: "ASC" | "DESC", nulls?: "NULLS FIRST" | "NULLS LAST"): this
  • orderBy(order: OrderByCondition): this
  • Sets ORDER BY condition in the query builder. If you had previously ORDER BY expression defined, calling this function will override previously set ORDER BY conditions.

    Calling order by without order set will remove all previously set order bys.

    Returns this

  • Sets ORDER BY condition in the query builder. If you had previously ORDER BY expression defined, calling this function will override previously set ORDER BY conditions.

    Parameters

    • sort: string
    • Optional order: "ASC" | "DESC"
    • Optional nulls: "NULLS FIRST" | "NULLS LAST"

    Returns this

  • Sets ORDER BY condition in the query builder. If you had previously ORDER BY expression defined, calling this function will override previously set ORDER BY conditions.

    Parameters

    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

set

setNativeParameters

setParameter

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

setParameters

setQueryRunner

update

updateEntity

  • updateEntity(enabled: boolean): this
  • Indicates if entity must be updated after update operation. 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

where

whereEntity

  • whereEntity(entity: Entity | Entity[]): this
  • Indicates if entity must be updated after update operation. This may produce extra query or use RETURNING / OUTPUT statement (depend on database). Enabled by default.

    Parameters

    • entity: Entity | Entity[]

    Returns this

whereInIds

  • whereInIds(ids: any | any[]): this

Generated using TypeDoc