kysely
    Preparing search index...

    Class WheneableMergeQueryBuilder<DB, TT, ST, O>

    Type Parameters

    • DB
    • TT extends keyof DB
    • ST extends keyof DB
    • O

    Implements

    Index

    Constructors

    Methods

    • Simply calls the provided function passing this as the only argument. $call returns what the provided function returns.

      If you want to conditionally call a method on this, see the $if method.

      The next example uses a helper function log to log a query:

      import type { Compilable } from 'kysely'

      function log<T extends Compilable>(qb: T): T {
      console.log(qb.compile())
      return qb
      }

      await db.updateTable('person')
      .set({ first_name: 'John' })
      .$call(log)
      .execute()

      Type Parameters

      • T

      Parameters

      • func: (qb: this) => T

      Returns T

    • This can be used to add any additional SQL to the end of the query.

      import { sql } from 'kysely'

      await db
      .mergeInto('person')
      .using('pet', 'pet.owner_id', 'person.id')
      .whenMatched()
      .thenDelete()
      .modifyEnd(sql.raw('-- this is a comment'))
      .execute()

      The generated SQL (PostgreSQL):

      merge into "person" using "pet" on "pet"."owner_id" = "person"."id" when matched then delete -- this is a comment
      

      Parameters

      Returns WheneableMergeQueryBuilder<DB, TT, ST, O>