可选queryRunner: QueryRunner只读@instanceof只读connectionConnection on which QueryBuilder was created.
只读expressionContains all properties of the QueryBuilder that needs to be build a final query.
受保护parentIf QueryBuilder was created in a subquery mode then its parent QueryBuilder (who created subquery) will be stored here.
受保护 可选queryQuery runner used to execute query builder query.
Adds CTE to query
可选options: QueryBuilderCteOptionsAdds ORDER BY condition in the query builder.
可选order: "ASC" | "DESC"可选nulls: "NULLS FIRST" | "NULLS LAST"Adds new AND WHERE condition in the query builder. Additionally you can add parameters used in where expression.
可选parameters: ObjectLiteralAdds new AND WHERE with conditions for the given ids.
Indicates if listeners and subscribers must be called before and after query execution. Enabled by default.
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.
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.
受保护create受保护create受保护createSpecifies FROM which entity's table select/update/delete will be executed. Also sets a main string alias of the selection data.
可选aliasName: string受保护createCreates "LIMIT" parts of SQL query.
受保护createCreates "ORDER BY" part of SQL query.
受保护create受保护createCreates a property paths for a given ObjectLiteral.
可选prefix: stringCreates a completely new query builder. Uses same query runner as current QueryBuilder.
可选queryRunner: QueryRunner受保护createCreates "RETURNING" / "OUTPUT" expression.
受保护createTime travel queries for CockroachDB
受保护createCreates UPDATE express used to perform insert query.
受保护create受保护createComputes given where argument - transforms to a where string all forms it can take.
可选alwaysWrap: boolean受保护createCreates "WHERE" expression.
Creates DELETE query.
Disables escaping.
Escapes table name, column name or alias name using current database's escaping character.
Executes sql generated by query builder and returns raw database results.
受保护get受保护getGets name of the table where insert should be performed.
Gets all parameters.
受保护getGets generated SQL query without parameters being replaced.
Gets query to be executed with all parameters used in it.
受保护getIf returning / output cause is set to array of column names, then this method will return all column metadatas of those column names.
Gets generated sql that will be executed. Parameters in the query are escaped for the currently used driver.
受保护getGets escaped table name with schema name if SqlServer driver used with custom schema name, otherwise returns escaped table name.
受保护getGets array of values need to be inserted into the target table.
受保护get受保护get受保护get受保护hasCheck the existence of a parameter for this query builder.
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?
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?
Creates INSERT query.
Sets LIMIT - maximum number of rows to be selected.
可选limit: number受保护obtainCreates a query builder used to execute sql queries inside this query builder.
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.
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.
可选order: "ASC" | "DESC"可选nulls: "NULLS FIRST" | "NULLS LAST"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.
Adds new OR WHERE condition in the query builder. Additionally you can add parameters used in where expression.
可选parameters: ObjectLiteralAdds new OR WHERE with conditions for the given ids.
Optional returning/output clause. This will return given column values.
Optional returning/output clause. Returning is a SQL string containing returning statement.
Optional returning/output clause.
Prints sql to stdout using console.log.
Sets entity's relation with which this query builder gonna work.
Sets entity's relation with which this query builder gonna work.
受保护replace受保护replaceReplaces all entity's propertyName to name in the given SQL string.
Optional returning/output clause. This will return given column values.
Optional returning/output clause. Returning is a SQL string containing returning statement.
Optional returning/output clause.
Creates SELECT query. Replaces all previous selections if they exist.
Creates SELECT query and selects given data. Replaces all previous selections if they exist.
可选selectionAliasName: stringCreates SELECT query and selects given data. Replaces all previous selections if they exist.
Sets parameter name and its value.
The key for this parameter may contain numbers, letters, underscores, or periods.
Creates UPDATE query and applies given update values.
Creates UPDATE query and applies given update values.
Creates UPDATE query for the given entity and applies given update values.
可选updateSet: _QueryDeepPartialEntity<ObjectLiteral extends Entity ? unknown : Entity>Creates UPDATE query for the given table name and applies given update values.
可选updateSet: _QueryDeepPartialEntity<ObjectLiteral extends Entity ? unknown : Entity>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.
If set to true the query will be wrapped into a transaction.
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.
可选parameters: ObjectLiteralSets 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.
静态register
Allows to build complex sql queries in a fashion way and execute those queries.