Skip to main content
Module

x/typeorm/src/query-builder/InsertQueryBuilder.ts>InsertQueryBuilder

Forked from https://github.com/typeorm/typeorm
Latest
class InsertQueryBuilder
import { InsertQueryBuilder } from "https://deno.land/x/typeorm@v0.2.23-rc10/src/query-builder/InsertQueryBuilder.ts";

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

Methods

protected
createColumnNamesExpression(): string

Creates a columns string where values must be inserted to for INSERT INTO expression.

Creates INSERT express used to perform insert query.

protected
createValuesExpression(): string

Creates list of values needs to be inserted in the VALUES expression.

Gets list of columns where values must be inserted to.

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

execute(): Promise<InsertResult>

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

getQuery(): string

Gets generated sql query without parameters being replaced.

into<T>(entityTarget: ObjectType<T> | EntitySchema<T> | string, columns?: string[]): InsertQueryBuilder<T>

Specifies INTO which entity's table insertion will be executed.

onConflict(statement: string): this

Adds additional ON CONFLICT statement supported in postgres and cockroach.

orIgnore(statement?: string | boolean): this

Adds additional ignore statement supported in databases.

orUpdate(statement?: { columns?: string[]; overwrite?: string[]; conflict_target?: string | string[]; }): this

Adds additional update statement supported in databases.

output(columns: string[]): this

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

output(output: string): this

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

output(output: string | string[]): this

Optional returning/output clause.

returning(columns: string[]): this

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

returning(returning: string): this

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

returning(returning: string | string[]): this

Optional returning/output clause.

updateEntity(enabled: boolean): this

Indicates if entity must be updated after insertion operations. This may produce extra query or use RETURNING / OUTPUT statement (depend on database). Enabled by default.

Values needs to be inserted into table.