import { kysely } from "https://deno.land/x/kysely_postgrs_js_dialect@v0.27.4/deps.ts";
const { WheneableMergeQueryBuilder } = kysely;
Adds a simple when matched
clause to the query.
For a when matched
clause with an and
condition, see whenMatchedAnd.
For a simple when not matched
clause, see whenNotMatched.
For a when not matched
clause with an and
condition, see whenNotMatchedAnd.
Examples
const result = await db.mergeInto('person')
.using('pet', 'person.id', 'pet.owner_id')
.whenMatched()
.thenDelete()
.execute()
The generated SQL (PostgreSQL):
merge into "person"
using "pet" on "person"."id" = "pet"."owner_id"
when matched then
delete
Returns
MatchedThenableMergeQueryBuilder<DB, TT, ST, TT | ST, O>