Skip to main content
Using Deno in production at your company? Earn free Deno merch.
Give us feedback
Module

x/kysely_postgrs_js_dialect/mod.ts>kysely.MatchedThenableMergeQueryBuilder#thenUpdateSet

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

Performs an update set action, similar to UpdateQueryBuilder.set.

For a full-fledged update query builder, see thenUpdate.

To perform the delete action, see thenDelete.

To perform the do nothing action, see thenDoNothing.

Examples

const result = await db.mergeInto('person')
  .using('pet', 'person.id', 'pet.owner_id')
  .whenMatched()
  .thenUpdateSet({
    middle_name: 'dog owner',
  })
  .execute()

The generate SQL (PostgreSQL):

merge into "person"
using "pet" on "person"."id" = "pet"."owner_id"
when matched then
  update set "middle_name" = $1

Type Parameters

UO extends UpdateObject<DB, UT, TT>

Parameters

update: UO

Type Parameters

U extends UpdateObjectFactory<DB, UT, TT>

Parameters

update: U

Type Parameters

RE extends ReferenceExpression<DB, TT>
VE extends ValueExpression<DB, UT, ExtractUpdateTypeFromReferenceExpression<DB, TT, RE>>

Parameters

key: RE
value: VE