import { kysely } from "https://dotland.deno.dev/x/kysely_postgrs_js_dialect@v0.27.4/deps.ts";
const { QueryCreator } = kysely;
Creates a replace query.
A MySQL-only statement similar to {@link InsertQueryBuilder.onDuplicateKeyUpdate} that deletes and inserts values on collision instead of updating existing rows.
The return value of this query is an instance of InsertResult. InsertResult has the {@link InsertResult.insertId | insertId} field that holds the auto incremented id of the inserted row if the db returned one.
See the {@link InsertQueryBuilder.values | values} method for more info and examples.
Examples
const result = await db
.replaceInto('person')
.values({
first_name: 'Jennifer',
last_name: 'Aniston'
})
.executeTakeFirst()
console.log(result.insertId)
Parameters
table: T