API 参考
    正在准备搜索索引...

    类 UpdateQueryBuilder<Entity>

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

    类型参数

    层级 (查看层级一览)

    实现

    索引

    构造函数

    属性

    "@instanceof": symbol
    connection: DataSource

    Connection on which QueryBuilder was created.

    expressionMap: QueryExpressionMap

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

    parentQueryBuilder: QueryBuilder<any>

    If QueryBuilder was created in a subquery mode then its parent QueryBuilder (who created subquery) will be stored here.

    queryRunner?: QueryRunner

    Query runner used to execute query builder query.

    访问器

    • get alias(): string

      Gets the main alias string used in this query builder.

      返回 string

    方法

    • Adds CTE to query

      参数

      • queryBuilder: string | QueryBuilder<any>
      • alias: string
      • 可选options: QueryBuilderCteOptions

      返回 this

    • Adds ORDER BY condition in the query builder.

      参数

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

      返回 this

    • Adds new AND WHERE condition in the query builder. Additionally you can add parameters used in where expression.

      参数

      返回 this

    • Adds new AND WHERE with conditions for the given ids.

      参数

      • ids: any

      返回 this

    • Indicates if listeners and subscribers must be called before and after query execution. Enabled by default.

      参数

      • enabled: boolean

      返回 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.

      返回 this

    • Includes a Query comment in the query builder. This is helpful for debugging purposes, such as finding a specific query in the database server's logs, or for categorization using an APM product.

      参数

      • comment: string

      返回 this

    • 返回 string

    • 返回 string

    • Specifies FROM which entity's table select/update/delete will be executed. Also sets a main string alias of the selection data.

      参数

      返回 Alias

    • Creates "LIMIT" parts of SQL query.

      返回 string

    • Creates "ORDER BY" part of SQL query.

      返回 string

    • 参数

      • value: any

      返回 string

    • Creates a property paths for a given ObjectLiteral.

      参数

      返回 string[]

    • Creates a completely new query builder. Uses same query runner as current QueryBuilder.

      参数

      返回 this

    • Creates "RETURNING" / "OUTPUT" expression.

      参数

      • returningType: ReturningType

      返回 string

    • Time travel queries for CockroachDB

      返回 string

    • Creates UPDATE express used to perform insert query.

      返回 string

    • 参数

      • clauses: WhereClause[]

      返回 string

    • Computes given where argument - transforms to a where string all forms it can take.

      参数

      • condition: WhereClauseCondition
      • 可选alwaysWrap: boolean

      返回 string

    • Creates "WHERE" expression.

      返回 string

    • Disables escaping.

      返回 this

    • Escapes table name, column name or alias name using current database's escaping character.

      参数

      • name: string

      返回 string

    • Executes sql generated by query builder and returns raw database results.

      返回 Promise<UpdateResult>

    • 参数

      • subQuery: any

      返回 [string, any[]]

    • Gets name of the table where insert should be performed.

      返回 string

    • Gets all parameters.

      返回 ObjectLiteral

    • 参数

      返回 Generator<any[], void, unknown>

    • Gets generated SQL query without parameters being replaced.

      返回 string

    • Gets query to be executed with all parameters used in it.

      返回 [string, any[]]

    • If returning / output cause is set to array of column names, then this method will return all column metadatas of those column names.

      返回 ColumnMetadata[]

    • Gets generated sql that will be executed. Parameters in the query are escaped for the currently used driver.

      返回 string

    • Gets escaped table name with schema name if SqlServer driver used with custom schema name, otherwise returns escaped table name.

      参数

      • tablePath: string

      返回 string

    • Gets array of values need to be inserted into the target table.

      返回 ObjectLiteral

    • 参数

      返回 WhereClauseCondition

    • Creates "WHERE" condition for an in-ids condition.

      参数

      • ids: any

      返回 ObjectLiteral | Brackets

    • 参数

      • aliasPath: string
      • parameterValue: any

      返回 WhereClauseCondition

    • 返回 boolean

    • Check the existence of a parameter for this query builder.

      参数

      • key: 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?

      类型参数

      • T

      参数

      返回 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?

      类型参数

      • T

      参数

      返回 boolean

    • Sets LIMIT - maximum number of rows to be selected.

      参数

      • 可选limit: number

      返回 this

    • Creates a query builder used to execute sql queries inside this query builder.

      返回 QueryRunner

    • 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.

      返回 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.

      参数

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

      返回 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.

      参数

      返回 this

    • Adds new OR WHERE condition in the query builder. Additionally you can add parameters used in where expression.

      参数

      返回 this

    • Adds new OR WHERE with conditions for the given ids.

      参数

      • ids: any

      返回 this

    • Optional returning/output clause. This will return given column values.

      参数

      • columns: string[]

      返回 this

    • Optional returning/output clause. Returning is a SQL string containing returning statement.

      参数

      • output: string

      返回 this

    • Optional returning/output clause.

      参数

      • output: string | string[]

      返回 this

    • Prints sql to stdout using console.log.

      返回 this

    • Sets entity's relation with which this query builder gonna work.

      参数

      • propertyPath: string

      返回 RelationQueryBuilder<Entity>

    • Sets entity's relation with which this query builder gonna work.

      类型参数

      参数

      返回 RelationQueryBuilder<T>

    • 参数

      • statement: string

      返回 string

      this way of replace property names is too slow. Instead, we'll replace property names at the end - once query is build.

    • Replaces all entity's propertyName to name in the given SQL string.

      参数

      • statement: string

      返回 string

    • 返回 SoftDeleteQueryBuilder<any>

    • Optional returning/output clause. This will return given column values.

      参数

      • columns: string[]

      返回 this

    • Optional returning/output clause. Returning is a SQL string containing returning statement.

      参数

      • returning: string

      返回 this

    • Optional returning/output clause.

      参数

      • returning: string | string[]

      返回 this

    • Creates SELECT query. Replaces all previous selections if they exist.

      返回 SelectQueryBuilder<Entity>

    • Creates SELECT query and selects given data. Replaces all previous selections if they exist.

      参数

      • selection: string
      • 可选selectionAliasName: string

      返回 SelectQueryBuilder<Entity>

    • Creates SELECT query and selects given data. Replaces all previous selections if they exist.

      参数

      • selection: string[]

      返回 SelectQueryBuilder<Entity>

    • Values needs to be updated.

      参数

      • values: QueryDeepPartialEntity<Entity>

      返回 this

    • Adds native parameters from the given object.

      参数

      返回 this

      Use setParameters instead

    • Sets parameter name and its value.

      The key for this parameter may contain numbers, letters, underscores, or periods.

      参数

      • key: string
      • value: any

      返回 this

    • Adds all parameters from the given object.

      参数

      返回 this

    • Sets or overrides query builder's QueryRunner.

      参数

      返回 this

    • 返回 SoftDeleteQueryBuilder<any>

    • 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.

      参数

      • enabled: boolean

      返回 this

    • If set to true the query will be wrapped into a transaction.

      参数

      • enabled: boolean

      返回 this

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

      参数

      返回 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.

      参数

      返回 this

    • Sets WHERE condition in the query builder with a condition for the given ids. If you had previously WHERE expression defined, calling this function will override previously set WHERE conditions.

      参数

      • ids: any

      返回 this

    • 参数

      • name: string
      • factory: any

      返回 void