import { kysely } from "https://deno.land/x/kysely_postgrs_js_dialect@v0.27.3/deps.ts";
const { QueryCreator } = kysely;
Creates a replace query.
A MySQL-only statement similar to 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 InsertResult.insertId | insertId field that holds the auto incremented id of the inserted row if the db returned one.
See the 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