Options
All
  • Public
  • Public/Protected
  • All
Menu

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

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 createDeleteExpression

  • createDeleteExpression(): string

Protected createFromAlias

  • createFromAlias(entityTarget: Function | string | function, aliasName?: undefined | string): Alias
  • Specifies FROM which entity's table select/update/delete will be executed. Also sets a main string alias of the selection data.

    Parameters

    • entityTarget: Function | string | function
    • Optional aliasName: undefined | string

    Returns Alias

createQueryBuilder

  • createQueryBuilder(): this

Protected createReturningExpression

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

from

Protected getMainTableName

  • getMainTableName(): string

getParameters

getQuery

  • getQuery(): string

getQueryAndParameters

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

Protected getReturningColumns

getSql

  • getSql(): string

Protected getTableName

  • getTableName(tablePath: string): string

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

Protected obtainQueryRunner

orWhere

orWhereInIds

  • orWhereInIds(ids: any | any[]): 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

useTransaction

  • useTransaction(enabled: boolean): this

where

whereInIds

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

Generated using TypeDoc