function insert
insert(
table: string,
values: Record<string, InValue | RawSql>,
returningColumns?: string,
): { sql: string; args: InValue[]; }

Build an INSERT statement from a table name and column-to-value record. A rawSql value goes into the SQL as written rather than as a bound placeholder, which is how a column takes an expression such as last_insert_rowid().

Pass returningColumns when the caller needs a value back from the written row, such as a generated key read with insertedRowId.

Parameters

table: string
values: Record<string, InValue | RawSql>
optional
returningColumns: string

Return Type

{ sql: string; args: InValue[]; }

Usage

import { insert } from "doc.ts";