kysely 0.13.0 → 0.14.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. package/dist/cjs/{introspection → dialect}/database-introspector.d.ts +0 -0
  2. package/dist/cjs/{introspection → dialect}/database-introspector.js +0 -0
  3. package/dist/cjs/dialect/dialect.d.ts +1 -1
  4. package/dist/cjs/dialect/mysql/mysql-dialect.d.ts +1 -1
  5. package/dist/cjs/dialect/mysql/mysql-introspector.d.ts +1 -1
  6. package/dist/cjs/dialect/postgres/postgres-dialect.d.ts +1 -1
  7. package/dist/cjs/dialect/postgres/postgres-introspector.d.ts +1 -1
  8. package/dist/cjs/dialect/sqlite/sqlite-dialect.d.ts +1 -1
  9. package/dist/cjs/dialect/sqlite/sqlite-introspector.d.ts +1 -1
  10. package/dist/cjs/index.d.ts +2 -2
  11. package/dist/cjs/index.js +2 -2
  12. package/dist/cjs/kysely.d.ts +1 -1
  13. package/dist/cjs/operation-node/check-constraint-node.d.ts +1 -1
  14. package/dist/cjs/operation-node/check-constraint-node.js +2 -3
  15. package/dist/cjs/operation-node/column-definition-node.d.ts +2 -2
  16. package/dist/cjs/operation-node/data-type-node.d.ts +1 -1
  17. package/dist/cjs/operation-node/generated-node.d.ts +20 -0
  18. package/dist/cjs/operation-node/generated-node.js +31 -0
  19. package/dist/cjs/operation-node/on-conflict-node.d.ts +13 -2
  20. package/dist/cjs/operation-node/on-conflict-node.js +39 -1
  21. package/dist/cjs/operation-node/operation-node-transformer.d.ts +2 -2
  22. package/dist/cjs/operation-node/operation-node-transformer.js +11 -5
  23. package/dist/cjs/operation-node/operation-node-visitor.d.ts +2 -2
  24. package/dist/cjs/operation-node/operation-node-visitor.js +1 -1
  25. package/dist/cjs/operation-node/operation-node.d.ts +1 -1
  26. package/dist/cjs/query-builder/insert-query-builder.d.ts +76 -75
  27. package/dist/cjs/query-builder/insert-query-builder.js +150 -15
  28. package/dist/cjs/query-builder/on-conflict-builder.d.ts +684 -0
  29. package/dist/cjs/query-builder/on-conflict-builder.js +323 -0
  30. package/dist/cjs/query-compiler/default-query-compiler.d.ts +2 -2
  31. package/dist/cjs/query-compiler/default-query-compiler.js +33 -7
  32. package/dist/cjs/schema/alter-table-builder.d.ts +29 -9
  33. package/dist/cjs/schema/alter-table-builder.js +33 -9
  34. package/dist/cjs/schema/column-definition-builder.d.ts +28 -8
  35. package/dist/cjs/schema/column-definition-builder.js +17 -7
  36. package/dist/cjs/schema/create-index-builder.d.ts +3 -2
  37. package/dist/cjs/schema/create-index-builder.js +2 -2
  38. package/dist/cjs/schema/create-table-builder.d.ts +3 -2
  39. package/dist/cjs/schema/create-table-builder.js +2 -2
  40. package/dist/esm/{introspection → dialect}/database-introspector.d.ts +0 -0
  41. package/dist/esm/{introspection → dialect}/database-introspector.js +0 -0
  42. package/dist/esm/dialect/dialect.d.ts +1 -1
  43. package/dist/esm/dialect/mysql/mysql-dialect.d.ts +1 -1
  44. package/dist/esm/dialect/mysql/mysql-introspector.d.ts +1 -1
  45. package/dist/esm/dialect/postgres/postgres-dialect.d.ts +1 -1
  46. package/dist/esm/dialect/postgres/postgres-introspector.d.ts +1 -1
  47. package/dist/esm/dialect/sqlite/sqlite-dialect.d.ts +1 -1
  48. package/dist/esm/dialect/sqlite/sqlite-introspector.d.ts +1 -1
  49. package/dist/esm/index.d.ts +2 -2
  50. package/dist/esm/index.js +2 -2
  51. package/dist/esm/kysely.d.ts +1 -1
  52. package/dist/esm/operation-node/check-constraint-node.d.ts +1 -1
  53. package/dist/esm/operation-node/check-constraint-node.js +2 -3
  54. package/dist/esm/operation-node/column-definition-node.d.ts +2 -2
  55. package/dist/esm/operation-node/data-type-node.d.ts +1 -1
  56. package/dist/esm/operation-node/generated-node.d.ts +20 -0
  57. package/dist/esm/operation-node/generated-node.js +28 -0
  58. package/dist/esm/operation-node/on-conflict-node.d.ts +13 -2
  59. package/dist/esm/operation-node/on-conflict-node.js +39 -1
  60. package/dist/esm/operation-node/operation-node-transformer.d.ts +2 -2
  61. package/dist/esm/operation-node/operation-node-transformer.js +11 -5
  62. package/dist/esm/operation-node/operation-node-visitor.d.ts +2 -2
  63. package/dist/esm/operation-node/operation-node-visitor.js +1 -1
  64. package/dist/esm/operation-node/operation-node.d.ts +1 -1
  65. package/dist/esm/query-builder/insert-query-builder.d.ts +76 -75
  66. package/dist/esm/query-builder/insert-query-builder.js +150 -15
  67. package/dist/esm/query-builder/on-conflict-builder.d.ts +684 -0
  68. package/dist/esm/query-builder/on-conflict-builder.js +317 -0
  69. package/dist/esm/query-compiler/default-query-compiler.d.ts +2 -2
  70. package/dist/esm/query-compiler/default-query-compiler.js +33 -7
  71. package/dist/esm/schema/alter-table-builder.d.ts +29 -9
  72. package/dist/esm/schema/alter-table-builder.js +33 -9
  73. package/dist/esm/schema/column-definition-builder.d.ts +28 -8
  74. package/dist/esm/schema/column-definition-builder.js +17 -7
  75. package/dist/esm/schema/create-index-builder.d.ts +3 -2
  76. package/dist/esm/schema/create-index-builder.js +2 -2
  77. package/dist/esm/schema/create-table-builder.d.ts +3 -2
  78. package/dist/esm/schema/create-table-builder.js +2 -2
  79. package/package.json +1 -1
  80. package/dist/cjs/operation-node/generated-always-as-node.d.ts +0 -16
  81. package/dist/cjs/operation-node/generated-always-as-node.js +0 -25
  82. package/dist/cjs/parser/on-conflict-parser.d.ts +0 -10
  83. package/dist/cjs/parser/on-conflict-parser.js +0 -35
  84. package/dist/esm/operation-node/generated-always-as-node.d.ts +0 -16
  85. package/dist/esm/operation-node/generated-always-as-node.js +0 -22
  86. package/dist/esm/parser/on-conflict-parser.d.ts +0 -10
  87. package/dist/esm/parser/on-conflict-parser.js +0 -30
@@ -0,0 +1,684 @@
1
+ import { OnConflictNode } from '../operation-node/on-conflict-node.js';
2
+ import { OperationNodeSource } from '../operation-node/operation-node-source.js';
3
+ import { ComplexExpression } from '../parser/complex-expression-parser.js';
4
+ import { WhereGrouper, FilterOperator, FilterValueExpressionOrList } from '../parser/filter-parser.js';
5
+ import { ParseContext } from '../parser/parse-context.js';
6
+ import { ReferenceExpression } from '../parser/reference-parser.js';
7
+ import { MutationObject } from '../parser/update-set-parser.js';
8
+ import { AnyColumn, AnyRawBuilder } from '../util/type-utils.js';
9
+ import { WhereInterface } from './where-interface.js';
10
+ export declare class OnConflictBuilder<DB, TB extends keyof DB> implements WhereInterface<DB, TB> {
11
+ #private;
12
+ constructor(props: OnConflictBuilderProps);
13
+ /**
14
+ * Specify a single column as the conflict target.
15
+ *
16
+ * Also see the {@link columns}, {@link constraint} and {@link expression}
17
+ * methods for alternative ways to specify the conflict target.
18
+ */
19
+ column(column: AnyColumn<DB, TB>): OnConflictBuilder<DB, TB>;
20
+ /**
21
+ * Specify a list of columns as the conflict target.
22
+ *
23
+ * Also see the {@link column}, {@link constraint} and {@link expression}
24
+ * methods for alternative ways to specify the conflict target.
25
+ */
26
+ columns(columns: ReadonlyArray<AnyColumn<DB, TB>>): OnConflictBuilder<DB, TB>;
27
+ /**
28
+ * Specify a specific constraint by name as the conflict target.
29
+ *
30
+ * Also see the {@link column}, {@link columns} and {@link expression}
31
+ * methods for alternative ways to specify the conflict target.
32
+ */
33
+ constraint(constraintName: string): OnConflictBuilder<DB, TB>;
34
+ /**
35
+ * Specify an expression as the conflict target.
36
+ *
37
+ * This can be used if the unique index is an expression index.
38
+ *
39
+ * Also see the {@link column}, {@link columns} and {@link constraint}
40
+ * methods for alternative ways to specify the conflict target.
41
+ */
42
+ expression(expression: AnyRawBuilder): OnConflictBuilder<DB, TB>;
43
+ /**
44
+ * Specify an index predicate for the index target.
45
+ *
46
+ * See {@link WhereInterface.where} for more info.
47
+ */
48
+ where<RE extends ReferenceExpression<DB, TB>>(lhs: RE, op: FilterOperator, rhs: FilterValueExpressionOrList<DB, TB, RE>): OnConflictBuilder<DB, TB>;
49
+ /**
50
+ * Adds a `where` clause to the query.
51
+ *
52
+ * Also see {@link orWhere}, {@link whereExists} and {@link whereRef}.
53
+ *
54
+ * ### Examples
55
+ *
56
+ * Find a row by column value:
57
+ *
58
+ * ```ts
59
+ * const person = await db
60
+ * .selectFrom('person')
61
+ * .selectAll()
62
+ * .where('id', '=', 100)
63
+ * .executeTakeFirst()
64
+ * ```
65
+ *
66
+ * The generated SQL (PostgreSQL):
67
+ *
68
+ * ```sql
69
+ * select * from "person" where "id" = $1
70
+ * ```
71
+ *
72
+ * Operator can be any supported operator or if the typings don't support it
73
+ * you can always use `db.raw('your operator')`.
74
+ *
75
+ * ```ts
76
+ * const persons = await db
77
+ * .selectFrom('person')
78
+ * .selectAll()
79
+ * .where('id', '>', 100)
80
+ * .execute()
81
+ * ```
82
+ *
83
+ * The generated SQL (PostgreSQL):
84
+ *
85
+ * ```sql
86
+ * select * from "person" where "id" > $1
87
+ * ```
88
+ *
89
+ * The `where` methods don't change the type of the query. You can add
90
+ * conditional `where`s easily by doing something like this:
91
+ *
92
+ * ```ts
93
+ * let query = db
94
+ * .selectFrom('person')
95
+ * .selectAll()
96
+ *
97
+ * if (firstName) {
98
+ * query = query.where('first_name', '=', firstName)
99
+ * }
100
+ *
101
+ * const persons = await query.execute()
102
+ * ```
103
+ *
104
+ * This is true for basically all methods execpt the `select` and
105
+ * `returning` methods, which DO change the return type of the
106
+ * query.
107
+ *
108
+ * Both the first and third argument can also be subqueries.
109
+ * A subquery is defined by passing a function and calling
110
+ * the `selectFrom` method of the object passed into the
111
+ * function:
112
+ *
113
+ * ```ts
114
+ * const persons = await db
115
+ * .selectFrom('person')
116
+ * .selectAll()
117
+ * .where(
118
+ * (qb) => qb.selectFrom('pet')
119
+ * .select('pet.name')
120
+ * .whereRef('pet.owner_id', '=', 'person.id')
121
+ * .limit(1),
122
+ * '=',
123
+ * 'Fluffy'
124
+ * )
125
+ * .execute()
126
+ * ```
127
+ *
128
+ * The generated SQL (PostgreSQL):
129
+ *
130
+ * ```sql
131
+ * select *
132
+ * from "person"
133
+ * where (
134
+ * select "pet"."name"
135
+ * from "pet"
136
+ * where "pet"."owner_id" = "person"."id"
137
+ * limit $1
138
+ * ) = $2
139
+ * ```
140
+ *
141
+ * A `where in` query can be built by using the `in` operator and an array
142
+ * of values. The values in the array can also be subqueries or raw
143
+ * instances.
144
+ *
145
+ * ```ts
146
+ * const persons = await db
147
+ * .selectFrom('person')
148
+ * .selectAll()
149
+ * .where('person.id', 'in', [100, 200, 300])
150
+ * .execute()
151
+ * ```
152
+ *
153
+ * The generated SQL (PostgreSQL):
154
+ *
155
+ * ```sql
156
+ * select * from "person" where "id" in ($1, $2, $3)
157
+ * ```
158
+ *
159
+ * If everything else fails, you can always pass {@link Kysely.raw | raw}
160
+ * as any of the arguments, including the operator:
161
+ *
162
+ * ```ts
163
+ * const persons = await db
164
+ * .selectFrom('person')
165
+ * .selectAll()
166
+ * .where(
167
+ * db.raw('coalesce(first_name, last_name)'),
168
+ * 'like',
169
+ * '%' + name + '%',
170
+ * )
171
+ * .execute()
172
+ * ```
173
+ *
174
+ * The generated SQL (PostgreSQL):
175
+ *
176
+ * ```sql
177
+ * select * from "person"
178
+ * where coalesce(first_name, last_name) like $1
179
+ * ```
180
+ *
181
+ * If you only pass one function argument to this method, it can be
182
+ * used to create parentheses around other where statements:
183
+ *
184
+ * ```ts
185
+ * const persons = await db
186
+ * .selectFrom('person')
187
+ * .selectAll()
188
+ * .where((qb) => qb
189
+ * .where('id', '=', 1)
190
+ * .orWhere('id', '=', 2)
191
+ * )
192
+ * .execute()
193
+ * ```
194
+ *
195
+ * The generated SQL (PostgreSQL):
196
+ *
197
+ * ```sql
198
+ * select * from "person" (where "id" = 1 or "id" = 2)
199
+ * ```
200
+ *
201
+ * In all examples above the columns were known at compile time
202
+ * (except for the `raw` expressions). By default kysely only allows
203
+ * you to refer to columns that exist in the database **and** can be
204
+ * referred to in the current query and context.
205
+ *
206
+ * Sometimes you may want to refer to columns that come from the user
207
+ * input and thus are not available at compile time.
208
+ *
209
+ * You have two options, `db.raw` or `db.dynamic`. The example below
210
+ * uses both:
211
+ *
212
+ * ```ts
213
+ * const { ref } = db.dynamic
214
+ *
215
+ * const persons = await db
216
+ * .selectFrom('person')
217
+ * .selectAll()
218
+ * .where(ref(columnFromUserInput), '=', 1)
219
+ * .orWhere(db.raw('??', [columnFromUserInput]), '=', 2)
220
+ * .execute()
221
+ * ```
222
+ */
223
+ where(grouper: WhereGrouper<DB, TB>): OnConflictBuilder<DB, TB>;
224
+ where(raw: AnyRawBuilder): OnConflictBuilder<DB, TB>;
225
+ /**
226
+ * Specify an index predicate for the index target.
227
+ *
228
+ * See {@link WhereInterface.whereRef} for more info.
229
+ */
230
+ whereRef(lhs: ReferenceExpression<DB, TB>, op: FilterOperator, rhs: ReferenceExpression<DB, TB>): OnConflictBuilder<DB, TB>;
231
+ /**
232
+ * Specify an index predicate for the index target.
233
+ *
234
+ * See {@link WhereInterface.orWhere} for more info.
235
+ */
236
+ orWhere<RE extends ReferenceExpression<DB, TB>>(lhs: RE, op: FilterOperator, rhs: FilterValueExpressionOrList<DB, TB, RE>): OnConflictBuilder<DB, TB>;
237
+ /**
238
+ * Adds an `or where` clause to the query. Otherwise works just like {@link where}.
239
+ *
240
+ * It's often necessary to wrap `or where` clauses in parentheses to control
241
+ * precendence. You can use the one argument version of the `where` method
242
+ * for that. See the examples.
243
+ *
244
+ * ### Examples
245
+ *
246
+ * ```ts
247
+ * const persons = await db
248
+ * .selectFrom('person')
249
+ * .selectAll()
250
+ * .where('id', '=', 1)
251
+ * .orWhere('id', '=', 2)
252
+ * .execute()
253
+ * ```
254
+ *
255
+ * The generated SQL (PostgreSQL):
256
+ *
257
+ * ```sql
258
+ * select * from "person" where "id" = 1 or "id" = 2
259
+ * ```
260
+ *
261
+ * Grouping with parentheses:
262
+ *
263
+ * ```ts
264
+ * const persons = await db
265
+ * .selectFrom('person')
266
+ * .selectAll()
267
+ * .where((qb) => qb
268
+ * .where('id', '=', 1)
269
+ * .orWhere('id', '=', 2)
270
+ * )
271
+ * .execute()
272
+ * ```
273
+ *
274
+ * The generated SQL (PostgreSQL):
275
+ *
276
+ * ```sql
277
+ * select * from "person" (where "id" = 1 or "id" = 2)
278
+ * ```
279
+ *
280
+ * Even the first `where` can be an `orWhere`. This is useful
281
+ * if you are looping through a set of conditions:
282
+ *
283
+ * ```ts
284
+ * const persons = await db
285
+ * .selectFrom('person')
286
+ * .selectAll()
287
+ * .where((qb) => qb
288
+ * .orWhere('id', '=', 1)
289
+ * .orWhere('id', '=', 2)
290
+ * )
291
+ * .execute()
292
+ * ```
293
+ *
294
+ * The generated SQL (PostgreSQL):
295
+ *
296
+ * ```sql
297
+ * select * from "person" (where "id" = 1 or "id" = 2)
298
+ * ```
299
+ */
300
+ orWhere(grouper: WhereGrouper<DB, TB>): OnConflictBuilder<DB, TB>;
301
+ orWhere(raw: AnyRawBuilder): OnConflictBuilder<DB, TB>;
302
+ /**
303
+ * Specify an index predicate for the index target.
304
+ *
305
+ * See {@link WhereInterface.orWhereRef} for more info.
306
+ */
307
+ orWhereRef(lhs: ReferenceExpression<DB, TB>, op: FilterOperator, rhs: ReferenceExpression<DB, TB>): OnConflictBuilder<DB, TB>;
308
+ /**
309
+ * Specify an index predicate for the index target.
310
+ *
311
+ * See {@link WhereInterface.whereExists} for more info.
312
+ */
313
+ whereExists(arg: ComplexExpression<DB, TB>): OnConflictBuilder<DB, TB>;
314
+ /**
315
+ * Specify an index predicate for the index target.
316
+ *
317
+ * See {@link WhereInterface.whereNotExists} for more info.
318
+ */
319
+ whereNotExists(arg: ComplexExpression<DB, TB>): OnConflictBuilder<DB, TB>;
320
+ /**
321
+ * Specify an index predicate for the index target.
322
+ *
323
+ * See {@link WhereInterface.orWhereExists} for more info.
324
+ */
325
+ orWhereExists(arg: ComplexExpression<DB, TB>): OnConflictBuilder<DB, TB>;
326
+ /**
327
+ * Specify an index predicate for the index target.
328
+ *
329
+ * See {@link WhereInterface.orWhereNotExists} for more info.
330
+ */
331
+ orWhereNotExists(arg: ComplexExpression<DB, TB>): OnConflictBuilder<DB, TB>;
332
+ /**
333
+ * Adds the "do nothing" conflict action.
334
+ *
335
+ * ### Examples
336
+ *
337
+ * ```ts
338
+ * await db
339
+ * .insertInto('person')
340
+ * .values({ id: db.generated, first_name, pic })
341
+ * .onConflict((oc) => oc
342
+ * .column('pic')
343
+ * .doNothing()
344
+ * )
345
+ * ```
346
+ *
347
+ * The generated SQL (PostgreSQL):
348
+ *
349
+ * ```sql
350
+ * insert into "person" ("first_name", "pic")
351
+ * values ($1, $2)
352
+ * on conflict ("pic") do nothing
353
+ * ```
354
+ */
355
+ doNothing(): OnConflictDoNothingBuilder<DB, TB>;
356
+ /**
357
+ * Adds the "do update set" conflict action.
358
+ *
359
+ * ### Examples
360
+ *
361
+ * ```ts
362
+ * await db
363
+ * .insertInto('person')
364
+ * .values({ id: db.generated, first_name, pic })
365
+ * .onConflict((oc) => oc
366
+ * .column('pic')
367
+ * .doUpdateSet({ first_name })
368
+ * )
369
+ * ```
370
+ *
371
+ * The generated SQL (PostgreSQL):
372
+ *
373
+ * ```sql
374
+ * insert into "person" ("first_name", "pic")
375
+ * values ($1, $2)
376
+ * on conflict ("pic")
377
+ * do update set "first_name" = $3
378
+ * ```
379
+ */
380
+ doUpdateSet(updates: MutationObject<DB, TB>): OnConflictUpdateBuilder<DB & Record<'excluded', DB[TB]>, TB | 'excluded'>;
381
+ }
382
+ export interface OnConflictBuilderProps {
383
+ readonly onConflictNode: OnConflictNode;
384
+ readonly parseContext: ParseContext;
385
+ }
386
+ export declare class OnConflictDoNothingBuilder<DB, TB extends keyof DB> implements OperationNodeSource {
387
+ #private;
388
+ constructor(props: OnConflictBuilderProps);
389
+ toOperationNode(): OnConflictNode;
390
+ }
391
+ export declare class OnConflictUpdateBuilder<DB, TB extends keyof DB> implements WhereInterface<DB, TB>, OperationNodeSource {
392
+ #private;
393
+ constructor(props: OnConflictBuilderProps);
394
+ /**
395
+ * Specify a where condition for the update operation.
396
+ *
397
+ * See {@link WhereInterface.where} for more info.
398
+ */
399
+ where<RE extends ReferenceExpression<DB, TB>>(lhs: RE, op: FilterOperator, rhs: FilterValueExpressionOrList<DB, TB, RE>): OnConflictUpdateBuilder<DB, TB>;
400
+ /**
401
+ * Adds a `where` clause to the query.
402
+ *
403
+ * Also see {@link orWhere}, {@link whereExists} and {@link whereRef}.
404
+ *
405
+ * ### Examples
406
+ *
407
+ * Find a row by column value:
408
+ *
409
+ * ```ts
410
+ * const person = await db
411
+ * .selectFrom('person')
412
+ * .selectAll()
413
+ * .where('id', '=', 100)
414
+ * .executeTakeFirst()
415
+ * ```
416
+ *
417
+ * The generated SQL (PostgreSQL):
418
+ *
419
+ * ```sql
420
+ * select * from "person" where "id" = $1
421
+ * ```
422
+ *
423
+ * Operator can be any supported operator or if the typings don't support it
424
+ * you can always use `db.raw('your operator')`.
425
+ *
426
+ * ```ts
427
+ * const persons = await db
428
+ * .selectFrom('person')
429
+ * .selectAll()
430
+ * .where('id', '>', 100)
431
+ * .execute()
432
+ * ```
433
+ *
434
+ * The generated SQL (PostgreSQL):
435
+ *
436
+ * ```sql
437
+ * select * from "person" where "id" > $1
438
+ * ```
439
+ *
440
+ * The `where` methods don't change the type of the query. You can add
441
+ * conditional `where`s easily by doing something like this:
442
+ *
443
+ * ```ts
444
+ * let query = db
445
+ * .selectFrom('person')
446
+ * .selectAll()
447
+ *
448
+ * if (firstName) {
449
+ * query = query.where('first_name', '=', firstName)
450
+ * }
451
+ *
452
+ * const persons = await query.execute()
453
+ * ```
454
+ *
455
+ * This is true for basically all methods execpt the `select` and
456
+ * `returning` methods, which DO change the return type of the
457
+ * query.
458
+ *
459
+ * Both the first and third argument can also be subqueries.
460
+ * A subquery is defined by passing a function and calling
461
+ * the `selectFrom` method of the object passed into the
462
+ * function:
463
+ *
464
+ * ```ts
465
+ * const persons = await db
466
+ * .selectFrom('person')
467
+ * .selectAll()
468
+ * .where(
469
+ * (qb) => qb.selectFrom('pet')
470
+ * .select('pet.name')
471
+ * .whereRef('pet.owner_id', '=', 'person.id')
472
+ * .limit(1),
473
+ * '=',
474
+ * 'Fluffy'
475
+ * )
476
+ * .execute()
477
+ * ```
478
+ *
479
+ * The generated SQL (PostgreSQL):
480
+ *
481
+ * ```sql
482
+ * select *
483
+ * from "person"
484
+ * where (
485
+ * select "pet"."name"
486
+ * from "pet"
487
+ * where "pet"."owner_id" = "person"."id"
488
+ * limit $1
489
+ * ) = $2
490
+ * ```
491
+ *
492
+ * A `where in` query can be built by using the `in` operator and an array
493
+ * of values. The values in the array can also be subqueries or raw
494
+ * instances.
495
+ *
496
+ * ```ts
497
+ * const persons = await db
498
+ * .selectFrom('person')
499
+ * .selectAll()
500
+ * .where('person.id', 'in', [100, 200, 300])
501
+ * .execute()
502
+ * ```
503
+ *
504
+ * The generated SQL (PostgreSQL):
505
+ *
506
+ * ```sql
507
+ * select * from "person" where "id" in ($1, $2, $3)
508
+ * ```
509
+ *
510
+ * If everything else fails, you can always pass {@link Kysely.raw | raw}
511
+ * as any of the arguments, including the operator:
512
+ *
513
+ * ```ts
514
+ * const persons = await db
515
+ * .selectFrom('person')
516
+ * .selectAll()
517
+ * .where(
518
+ * db.raw('coalesce(first_name, last_name)'),
519
+ * 'like',
520
+ * '%' + name + '%',
521
+ * )
522
+ * .execute()
523
+ * ```
524
+ *
525
+ * The generated SQL (PostgreSQL):
526
+ *
527
+ * ```sql
528
+ * select * from "person"
529
+ * where coalesce(first_name, last_name) like $1
530
+ * ```
531
+ *
532
+ * If you only pass one function argument to this method, it can be
533
+ * used to create parentheses around other where statements:
534
+ *
535
+ * ```ts
536
+ * const persons = await db
537
+ * .selectFrom('person')
538
+ * .selectAll()
539
+ * .where((qb) => qb
540
+ * .where('id', '=', 1)
541
+ * .orWhere('id', '=', 2)
542
+ * )
543
+ * .execute()
544
+ * ```
545
+ *
546
+ * The generated SQL (PostgreSQL):
547
+ *
548
+ * ```sql
549
+ * select * from "person" (where "id" = 1 or "id" = 2)
550
+ * ```
551
+ *
552
+ * In all examples above the columns were known at compile time
553
+ * (except for the `raw` expressions). By default kysely only allows
554
+ * you to refer to columns that exist in the database **and** can be
555
+ * referred to in the current query and context.
556
+ *
557
+ * Sometimes you may want to refer to columns that come from the user
558
+ * input and thus are not available at compile time.
559
+ *
560
+ * You have two options, `db.raw` or `db.dynamic`. The example below
561
+ * uses both:
562
+ *
563
+ * ```ts
564
+ * const { ref } = db.dynamic
565
+ *
566
+ * const persons = await db
567
+ * .selectFrom('person')
568
+ * .selectAll()
569
+ * .where(ref(columnFromUserInput), '=', 1)
570
+ * .orWhere(db.raw('??', [columnFromUserInput]), '=', 2)
571
+ * .execute()
572
+ * ```
573
+ */
574
+ where(grouper: WhereGrouper<DB, TB>): OnConflictUpdateBuilder<DB, TB>;
575
+ where(raw: AnyRawBuilder): OnConflictUpdateBuilder<DB, TB>;
576
+ /**
577
+ * Specify a where condition for the update operation.
578
+ *
579
+ * See {@link WhereInterface.whereRef} for more info.
580
+ */
581
+ whereRef(lhs: ReferenceExpression<DB, TB>, op: FilterOperator, rhs: ReferenceExpression<DB, TB>): OnConflictUpdateBuilder<DB, TB>;
582
+ /**
583
+ * Specify a where condition for the update operation.
584
+ *
585
+ * See {@link WhereInterface.orWhere} for more info.
586
+ */
587
+ orWhere<RE extends ReferenceExpression<DB, TB>>(lhs: RE, op: FilterOperator, rhs: FilterValueExpressionOrList<DB, TB, RE>): OnConflictUpdateBuilder<DB, TB>;
588
+ /**
589
+ * Adds an `or where` clause to the query. Otherwise works just like {@link where}.
590
+ *
591
+ * It's often necessary to wrap `or where` clauses in parentheses to control
592
+ * precendence. You can use the one argument version of the `where` method
593
+ * for that. See the examples.
594
+ *
595
+ * ### Examples
596
+ *
597
+ * ```ts
598
+ * const persons = await db
599
+ * .selectFrom('person')
600
+ * .selectAll()
601
+ * .where('id', '=', 1)
602
+ * .orWhere('id', '=', 2)
603
+ * .execute()
604
+ * ```
605
+ *
606
+ * The generated SQL (PostgreSQL):
607
+ *
608
+ * ```sql
609
+ * select * from "person" where "id" = 1 or "id" = 2
610
+ * ```
611
+ *
612
+ * Grouping with parentheses:
613
+ *
614
+ * ```ts
615
+ * const persons = await db
616
+ * .selectFrom('person')
617
+ * .selectAll()
618
+ * .where((qb) => qb
619
+ * .where('id', '=', 1)
620
+ * .orWhere('id', '=', 2)
621
+ * )
622
+ * .execute()
623
+ * ```
624
+ *
625
+ * The generated SQL (PostgreSQL):
626
+ *
627
+ * ```sql
628
+ * select * from "person" (where "id" = 1 or "id" = 2)
629
+ * ```
630
+ *
631
+ * Even the first `where` can be an `orWhere`. This is useful
632
+ * if you are looping through a set of conditions:
633
+ *
634
+ * ```ts
635
+ * const persons = await db
636
+ * .selectFrom('person')
637
+ * .selectAll()
638
+ * .where((qb) => qb
639
+ * .orWhere('id', '=', 1)
640
+ * .orWhere('id', '=', 2)
641
+ * )
642
+ * .execute()
643
+ * ```
644
+ *
645
+ * The generated SQL (PostgreSQL):
646
+ *
647
+ * ```sql
648
+ * select * from "person" (where "id" = 1 or "id" = 2)
649
+ * ```
650
+ */
651
+ orWhere(grouper: WhereGrouper<DB, TB>): OnConflictUpdateBuilder<DB, TB>;
652
+ orWhere(raw: AnyRawBuilder): OnConflictUpdateBuilder<DB, TB>;
653
+ /**
654
+ * Specify a where condition for the update operation.
655
+ *
656
+ * See {@link WhereInterface.orWhereRef} for more info.
657
+ */
658
+ orWhereRef(lhs: ReferenceExpression<DB, TB>, op: FilterOperator, rhs: ReferenceExpression<DB, TB>): OnConflictUpdateBuilder<DB, TB>;
659
+ /**
660
+ * Specify a where condition for the update operation.
661
+ *
662
+ * See {@link WhereInterface.whereExists} for more info.
663
+ */
664
+ whereExists(arg: ComplexExpression<DB, TB>): OnConflictUpdateBuilder<DB, TB>;
665
+ /**
666
+ * Specify a where condition for the update operation.
667
+ *
668
+ * See {@link WhereInterface.whereNotExists} for more info.
669
+ */
670
+ whereNotExists(arg: ComplexExpression<DB, TB>): OnConflictUpdateBuilder<DB, TB>;
671
+ /**
672
+ * Specify a where condition for the update operation.
673
+ *
674
+ * See {@link WhereInterface.orWhereExists} for more info.
675
+ */
676
+ orWhereExists(arg: ComplexExpression<DB, TB>): OnConflictUpdateBuilder<DB, TB>;
677
+ /**
678
+ * Specify a where condition for the update operation.
679
+ *
680
+ * See {@link WhereInterface.orWhereNotExists} for more info.
681
+ */
682
+ orWhereNotExists(arg: ComplexExpression<DB, TB>): OnConflictUpdateBuilder<DB, TB>;
683
+ toOperationNode(): OnConflictNode;
684
+ }