Module

x/kysely_postgrs_js_dialect/mod.ts>kysely.InsertQueryBuilder#columns

Kysely dialect for PostgreSQL using the Postgres.js client.
Latest
method kysely.InsertQueryBuilder.prototype.columns
import { kysely } from "https://dotland.deno.dev/x/kysely_postgrs_js_dialect@v0.27.4/mod.ts";
const { InsertQueryBuilder } = kysely;

Sets the columns to insert.

The {@link values} method sets both the columns and the values and this method is not needed. But if you are using the {@link expression} method, you can use this method to set the columns to insert.

Examples

db.insertInto('person')
  .columns(['first_name'])
  .expression((eb) => eb.selectFrom('pet').select('pet.name'))

The generated SQL (PostgreSQL):

insert into "person" ("first_name")
select "pet"."name" from "pet"

Parameters

columns: ReadonlyArray<keyof DB[TB] & string>