Hi there! Are you looking for the official Deno documentation? Try docs.deno.com for all your Deno learning needs.

PgInsert

interface PgInsert <TTable extends AnyPgTable, TQueryResult extends QueryResultHKT, TReturning extends Record<string, unknown> | undefined = undefined> extends QueryPromise<TReturning extends undefined ? QueryResultKind<TQueryResult, never> : TReturning[]>, SQLWrapper {}
class PgInsert<TTable extends AnyPgTable, TQueryResult extends QueryResultHKT, TReturning extends Record<string, unknown> | undefined = undefined> extends QueryPromise<TReturning extends undefined ? QueryResultKind<TQueryResult, never> : TReturning[]> implements SQLWrapper {
constructor(
table: TTable,
values: PgInsertConfig["values"],
session: PgSession,
dialect: PgDialect,
);
private _prepare;
private config;
private dialect;
private session;
_: {
table: TTable;
return: TReturning;
}
;
execute: ReturnType<this["prepare"]>["execute"];
 
onConflictDoNothing(config?: {
target?: IndexColumn | IndexColumn[];
where?: SQL;
}
): this;
onConflictDoUpdate(config: {
target: IndexColumn | IndexColumn[];
where?: SQL;
set: PgUpdateSetSource<TTable>;
}
): this;
prepare(name: string): PreparedQuery<PreparedQueryConfig & {
execute: TReturning extends undefined ? QueryResultKind<TQueryResult, never> : TReturning[];
}
>
;
returning(): PgInsert<TTable, TQueryResult, InferModel<TTable>>;
returning<TSelectedFields extends SelectedFieldsFlat>(fields: TSelectedFields): PgInsert<TTable, TQueryResult, SelectResultFields<TSelectedFields>>;
toSQL(): Simplify<Omit<Query, "typings">>;
}

§Type Parameters

§
TTable extends AnyPgTable
[src]
§
TQueryResult extends QueryResultHKT
[src]
§
TReturning extends Record<string, unknown> | undefined = undefined
[src]

§Extends

§
QueryPromise<TReturning extends undefined ? QueryResultKind<TQueryResult, never> : TReturning[]>
[src]

§Type Parameters

§
TTable extends AnyPgTable
[src]
§
TQueryResult extends QueryResultHKT
[src]
§
TReturning extends Record<string, unknown> | undefined = undefined
[src]

§Extends

§
QueryPromise<TReturning extends undefined ? QueryResultKind<TQueryResult, never> : TReturning[]>
[src]

§Implements

§Constructors

§
new PgInsert(table: TTable, values: PgInsertConfig["values"], session: PgSession, dialect: PgDialect)
[src]

§Properties

§
_prepare
[src]
§
config
[src]
§
dialect
[src]
§
session
[src]
§
_: {
table: TTable;
return: TReturning;
}
[src]
§
execute: ReturnType<this["prepare"]>["execute"]
[src]

§Methods

§
onConflictDoNothing(config?: {
target?: IndexColumn | IndexColumn[];
where?: SQL;
}
): this
[src]
§
onConflictDoUpdate(config: {
target: IndexColumn | IndexColumn[];
where?: SQL;
set: PgUpdateSetSource<TTable>;
}
): this
[src]
§
prepare(name: string): PreparedQuery<PreparedQueryConfig & {
execute: TReturning extends undefined ? QueryResultKind<TQueryResult, never> : TReturning[];
}
>
[src]
§
returning(): PgInsert<TTable, TQueryResult, InferModel<TTable>>
[src]
returning<TSelectedFields extends SelectedFieldsFlat>(fields: TSelectedFields): PgInsert<TTable, TQueryResult, SelectResultFields<TSelectedFields>>
[src]
§
toSQL(): Simplify<Omit<Query, "typings">>
[src]