MCPcopy
hub / github.com/kysely-org/kysely / WheneableMergeQueryBuilder

Class WheneableMergeQueryBuilder

src/query-builder/merge-query-builder.ts:320–935  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

318}
319
320export class WheneableMergeQueryBuilder<
321 DB,
322 TT extends keyof DB,
323 ST extends keyof DB,
324 O,
325>
326 implements
327 MultiTableReturningInterface<DB, TT | ST, O>,
328 OutputInterface<DB, TT, O>,
329 OperationNodeSource,
330 Compilable<O>,
331 Executable<O>
332{
333 readonly #props: MergeQueryBuilderProps
334
335 constructor(props: MergeQueryBuilderProps) {
336 this.#props = freeze(props)
337 }
338
339 /**
340 * This can be used to add any additional SQL to the end of the query.
341 *
342 * ### Examples
343 *
344 * ```ts
345 * import { sql } from 'kysely'
346 *
347 * await db
348 * .mergeInto('person')
349 * .using('pet', 'pet.owner_id', 'person.id')
350 * .whenMatched()
351 * .thenDelete()
352 * .modifyEnd(sql.raw('-- this is a comment'))
353 * .execute()
354 * ```
355 *
356 * The generated SQL (PostgreSQL):
357 *
358 * ```sql
359 * merge into "person" using "pet" on "pet"."owner_id" = "person"."id" when matched then delete -- this is a comment
360 * ```
361 */
362 modifyEnd(
363 modifier: Expression<any>,
364 ): WheneableMergeQueryBuilder<DB, TT, ST, O> {
365 return new WheneableMergeQueryBuilder({
366 ...this.#props,
367 queryNode: QueryNode.cloneWithEndModifier(
368 this.#props.queryNode,
369 modifier.toOperationNode(),
370 ),
371 })
372 }
373
374 /**
375 * See {@link MergeQueryBuilder.top}.
376 */
377 top(

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…