Options
All
  • Public
  • Public/Protected
  • All
Menu

Class SelectQueryBuilder<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

addFrom

addGroupBy

  • addGroupBy(groupBy: string): this

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

addSelect

  • addSelect(selection: function, selectionAliasName?: string): this
  • addSelect(selection: string, selectionAliasName?: string): this
  • addSelect(selection: string[]): this

andHaving

andWhere

andWhereInIds

  • andWhereInIds(ids: any | any[]): this
  • Adds new AND WHERE with conditions for the given ids.

    Ids are mixed. It means if you have single primary key you can pass a simple id values, for example [1, 2, 3]. If you have multiple primary keys you need to pass object with property names and values specified, for example [{ firstId: 1, secondId: 2 }, { firstId: 2, secondId: 3 }, ...]

    Parameters

    • ids: any | any[]

    Returns this

Protected buildEscapedEntityColumnSelects

cache

  • cache(enabled: boolean): this
  • cache(milliseconds: number): this
  • cache(id: any, milliseconds?: number): 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 createGroupByExpression

  • createGroupByExpression(): string

Protected createHavingExpression

  • createHavingExpression(): string

Protected createJoinExpression

  • createJoinExpression(): string

Protected createLimitOffsetExpression

  • createLimitOffsetExpression(): string

Protected createLockExpression

  • createLockExpression(): string

Protected createOrderByCombinedWithSelectExpression

  • createOrderByCombinedWithSelectExpression(parentAlias: string): [string, OrderByCondition]

Protected createOrderByExpression

  • createOrderByExpression(): string

createQueryBuilder

  • createQueryBuilder(): this

Protected createReturningExpression

  • createReturningExpression(): string

Protected createSelectExpression

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

  • execute(): Promise<any>

Protected executeCountQuery

  • executeCountQuery(queryRunner: QueryRunner): Promise<number>

Protected executeEntitiesAndRawResults

  • executeEntitiesAndRawResults(queryRunner: QueryRunner): Promise<object>

Protected findEntityColumnSelects

from

getCount

  • getCount(): Promise<number>
  • Gets count - number of entities selected by sql generated by this query builder. Count excludes all limitations set by setFirstResult and setMaxResults methods call.

    Returns Promise<number>

Protected getMainTableName

  • getMainTableName(): string

getMany

  • getMany(): Promise<Entity[]>

getManyAndCount

  • getManyAndCount(): Promise<[Entity[], number]>
  • Executes built SQL query and returns entities and overall entities count (without limitation). This method is useful to build pagination.

    Returns Promise<[Entity[], number]>

getOne

  • getOne(): Promise<Entity | undefined>

getParameters

getQuery

  • getQuery(): string

getQueryAndParameters

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

getRawAndEntities

  • getRawAndEntities(): Promise<object>

getRawMany

  • getRawMany(): Promise<any[]>

getRawOne

  • getRawOne(): Promise<any>

Protected getReturningColumns

getSql

  • getSql(): string

Protected getTableName

  • getTableName(tablePath: string): string

groupBy

  • groupBy(): this
  • groupBy(groupBy: string): this
  • Sets GROUP BY condition in the query builder. If you had previously GROUP BY expression defined, calling this function will override previously set GROUP BY conditions.

    Returns this

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

    Parameters

    • groupBy: string

    Returns this

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

having

  • Sets HAVING condition in the query builder. If you had previously HAVING expression defined, calling this function will override previously set HAVING conditions. Additionally you can add parameters used in where expression.

    Parameters

    Returns this

innerJoin

  • innerJoin(subQueryFactory: function, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • innerJoin(property: string, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • innerJoin(entity: Function | string, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • innerJoin(tableName: string, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • INNER JOINs (without selection) given subquery. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    Returns this

  • INNER JOINs (without selection) entity's property. Given entity property should be a relation. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • property: string
    • alias: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • INNER JOINs (without selection) given entity's table. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • entity: Function | string
    • alias: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • INNER JOINs (without selection) given table. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • tableName: string
    • alias: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral

    Returns this

innerJoinAndMapMany

  • innerJoinAndMapMany(mapToProperty: string, subQueryFactory: function, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • innerJoinAndMapMany(mapToProperty: string, property: string, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • innerJoinAndMapMany(mapToProperty: string, entity: Function | string, alias: string, condition: string, parameters?: ObjectLiteral): this
  • innerJoinAndMapMany(mapToProperty: string, tableName: string, alias: string, condition: string, parameters?: ObjectLiteral): this
  • INNER JOINs given subquery, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there are multiple rows of selecting data, and mapped result will be an array. Given entity property should be a relation. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    Returns this

  • INNER JOINs entity's property, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there are multiple rows of selecting data, and mapped result will be an array. Given entity property should be a relation. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • mapToProperty: string
    • property: string
    • alias: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • INNER JOINs entity's table, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there are multiple rows of selecting data, and mapped result will be an array. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • mapToProperty: string
    • entity: Function | string
    • alias: string
    • condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • INNER JOINs table, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there are multiple rows of selecting data, and mapped result will be an array. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • mapToProperty: string
    • tableName: string
    • alias: string
    • condition: string
    • Optional parameters: ObjectLiteral

    Returns this

innerJoinAndMapOne

  • innerJoinAndMapOne(mapToProperty: string, subQueryFactory: function, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • innerJoinAndMapOne(mapToProperty: string, property: string, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • innerJoinAndMapOne(mapToProperty: string, entity: Function | string, alias: string, condition: string, parameters?: ObjectLiteral): this
  • innerJoinAndMapOne(mapToProperty: string, tableName: string, alias: string, condition: string, parameters?: ObjectLiteral): this
  • INNER JOINs given subquery, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there is a single row of selecting data, and mapped result will be a single selected value. Given entity property should be a relation. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    Returns this

  • INNER JOINs entity's property, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there is a single row of selecting data, and mapped result will be a single selected value. Given entity property should be a relation. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • mapToProperty: string
    • property: string
    • alias: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • INNER JOINs entity's table, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there is a single row of selecting data, and mapped result will be a single selected value. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • mapToProperty: string
    • entity: Function | string
    • alias: string
    • condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • INNER JOINs table, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there is a single row of selecting data, and mapped result will be a single selected value. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • mapToProperty: string
    • tableName: string
    • alias: string
    • condition: string
    • Optional parameters: ObjectLiteral

    Returns this

innerJoinAndSelect

  • innerJoinAndSelect(subQueryFactory: function, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • innerJoinAndSelect(property: string, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • innerJoinAndSelect(entity: Function | string, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • innerJoinAndSelect(tableName: string, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • INNER JOINs given subquery and adds all selection properties to SELECT.. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    Returns this

  • INNER JOINs entity's property and adds all selection properties to SELECT. Given entity property should be a relation. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • property: string
    • alias: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • INNER JOINs entity and adds all selection properties to SELECT. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • entity: Function | string
    • alias: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • INNER JOINs table and adds all selection properties to SELECT. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • tableName: string
    • alias: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral

    Returns this

insert

Protected join

  • join(direction: "INNER" | "LEFT", entityOrProperty: Function | string | function, aliasName: string, condition?: string, parameters?: ObjectLiteral, mapToProperty?: string, isMappingMany?: boolean): void
  • Parameters

    • direction: "INNER" | "LEFT"
    • entityOrProperty: Function | string | function
    • aliasName: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral
    • Optional mapToProperty: string
    • Optional isMappingMany: boolean

    Returns void

leftJoin

  • leftJoin(subQueryFactory: function, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • leftJoin(property: string, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • leftJoin(entity: Function | string, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • leftJoin(tableName: string, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • LEFT JOINs (without selection) given subquery. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    Returns this

  • LEFT JOINs (without selection) entity's property. Given entity property should be a relation. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • property: string
    • alias: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • LEFT JOINs (without selection) entity's table. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • entity: Function | string
    • alias: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • LEFT JOINs (without selection) given table. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • tableName: string
    • alias: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral

    Returns this

leftJoinAndMapMany

  • leftJoinAndMapMany(mapToProperty: string, subQueryFactory: function, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • leftJoinAndMapMany(mapToProperty: string, property: string, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • leftJoinAndMapMany(mapToProperty: string, entity: Function | string, alias: string, condition: string, parameters?: ObjectLiteral): this
  • leftJoinAndMapMany(mapToProperty: string, tableName: string, alias: string, condition: string, parameters?: ObjectLiteral): this
  • LEFT JOINs given subquery, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there are multiple rows of selecting data, and mapped result will be an array. Given entity property should be a relation. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    Returns this

  • LEFT JOINs entity's property, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there are multiple rows of selecting data, and mapped result will be an array. Given entity property should be a relation. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • mapToProperty: string
    • property: string
    • alias: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • LEFT JOINs entity's table, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there are multiple rows of selecting data, and mapped result will be an array. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • mapToProperty: string
    • entity: Function | string
    • alias: string
    • condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • LEFT JOINs table, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there are multiple rows of selecting data, and mapped result will be an array. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • mapToProperty: string
    • tableName: string
    • alias: string
    • condition: string
    • Optional parameters: ObjectLiteral

    Returns this

leftJoinAndMapOne

  • leftJoinAndMapOne(mapToProperty: string, subQueryFactory: function, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • leftJoinAndMapOne(mapToProperty: string, property: string, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • leftJoinAndMapOne(mapToProperty: string, entity: Function | string, alias: string, condition: string, parameters?: ObjectLiteral): this
  • leftJoinAndMapOne(mapToProperty: string, tableName: string, alias: string, condition: string, parameters?: ObjectLiteral): this
  • LEFT JOINs given subquery, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there is a single row of selecting data, and mapped result will be a single selected value. Given entity property should be a relation. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    Returns this

  • LEFT JOINs entity's property, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there is a single row of selecting data, and mapped result will be a single selected value. Given entity property should be a relation. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • mapToProperty: string
    • property: string
    • alias: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • LEFT JOINs entity's table, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there is a single row of selecting data, and mapped result will be a single selected value. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • mapToProperty: string
    • entity: Function | string
    • alias: string
    • condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • LEFT JOINs table, SELECTs the data returned by a join and MAPs all that data to some entity's property. This is extremely useful when you want to select some data and map it to some virtual property. It will assume that there is a single row of selecting data, and mapped result will be a single selected value. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • mapToProperty: string
    • tableName: string
    • alias: string
    • condition: string
    • Optional parameters: ObjectLiteral

    Returns this

leftJoinAndSelect

  • leftJoinAndSelect(subQueryFactory: function, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • leftJoinAndSelect(property: string, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • leftJoinAndSelect(entity: Function | string, alias: string, condition: string, parameters?: ObjectLiteral): this
  • leftJoinAndSelect(tableName: string, alias: string, condition?: string, parameters?: ObjectLiteral): this
  • LEFT JOINs given subquery and adds all selection properties to SELECT.. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    Returns this

  • LEFT JOINs entity's property and adds all selection properties to SELECT. Given entity property should be a relation. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • property: string
    • alias: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • LEFT JOINs entity and adds all selection properties to SELECT. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • entity: Function | string
    • alias: string
    • condition: string
    • Optional parameters: ObjectLiteral

    Returns this

  • LEFT JOINs table and adds all selection properties to SELECT. You also need to specify an alias of the joined data. Optionally, you can add condition and parameters used in condition.

    Parameters

    • tableName: string
    • alias: string
    • Optional condition: string
    • Optional parameters: ObjectLiteral

    Returns this

limit

  • limit(limit?: number): this
  • Set's LIMIT - maximum number of rows to be selected. NOTE that it may not work as you expect if you are using joins. If you want to implement pagination, and you are having join in your query, then use instead take method instead.

    Parameters

    • Optional limit: number

    Returns this

loadAllRelationIds

  • loadAllRelationIds(options?: object): this
  • Loads all relation ids for all relations of the selected entity. All relation ids will be mapped to relation property themself. If array of strings is given then loads only relation ids of the given properties.

    Parameters

    • Optional options: object
      • Optional disableMixedMap?: boolean
      • Optional relations?: string[]

    Returns this

Protected loadRawResults

  • loadRawResults(queryRunner: QueryRunner): Promise<any>

loadRelationCountAndMap

  • loadRelationCountAndMap(mapToProperty: string, relationName: string, aliasName?: string, queryBuilderFactory?: function): this

loadRelationIdAndMap

  • loadRelationIdAndMap(mapToProperty: string, relationName: string, options?: object): this
  • loadRelationIdAndMap(mapToProperty: string, relationName: string, alias: string, queryBuilderFactory: function): this

Protected mergeExpressionMap

Protected normalizeNumber

  • normalizeNumber(num: any): any

Protected obtainQueryRunner

offset

  • offset(offset?: number): this
  • Set's OFFSET - selection offset. NOTE that it may not work as you expect if you are using joins. If you want to implement pagination, and you are having join in your query, then use instead skip method instead.

    Parameters

    • Optional offset: number

    Returns this

orHaving

orWhere

orWhereInIds

  • orWhereInIds(ids: any | any[]): this
  • Adds new OR WHERE with conditions for the given ids.

    Ids are mixed. It means if you have single primary key you can pass a simple id values, for example [1, 2, 3]. If you have multiple primary keys you need to pass object with property names and values specified, for example [{ firstId: 1, secondId: 2 }, { firstId: 2, secondId: 3 }, ...]

    Parameters

    • ids: any | any[]

    Returns 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

printSql

  • printSql(): this

relation

Protected replacePropertyNames

  • replacePropertyNames(statement: string): string

select

  • select(): this
  • select(selection: function, selectionAliasName?: string): this
  • select(selection: string, selectionAliasName?: string): this
  • select(selection: string[]): this

setLock

  • setLock(lockMode: "optimistic", lockVersion: number): this
  • setLock(lockMode: "optimistic", lockVersion: Date): this
  • setLock(lockMode: "pessimistic_read" | "pessimistic_write"): this

setNativeParameters

setOption

setParameter

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

setParameters

setQueryRunner

skip

  • skip(skip?: number): this

stream

  • stream(): Promise<ReadStream>

subQuery

take

  • take(take?: number): this

update

useTransaction

  • useTransaction(enabled: boolean): this

where

whereInIds

  • whereInIds(ids: any | any[]): this
  • Adds new AND WHERE with conditions for the given ids.

    Ids are mixed. It means if you have single primary key you can pass a simple id values, for example [1, 2, 3]. If you have multiple primary keys you need to pass object with property names and values specified, for example [{ firstId: 1, secondId: 2 }, { firstId: 2, secondId: 3 }, ...]

    Parameters

    • ids: any | any[]

    Returns this

Generated using TypeDoc