drizzle-orm 0.29.0 → 0.29.1-e78b53e

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 (146) hide show
  1. package/mysql-core/db.cjs +134 -31
  2. package/mysql-core/db.cjs.map +1 -1
  3. package/mysql-core/db.d.cts +171 -1
  4. package/mysql-core/db.d.ts +171 -1
  5. package/mysql-core/db.js +134 -31
  6. package/mysql-core/db.js.map +1 -1
  7. package/mysql-core/query-builders/delete.cjs +29 -0
  8. package/mysql-core/query-builders/delete.cjs.map +1 -1
  9. package/mysql-core/query-builders/delete.d.cts +29 -0
  10. package/mysql-core/query-builders/delete.d.ts +29 -0
  11. package/mysql-core/query-builders/delete.js +29 -0
  12. package/mysql-core/query-builders/delete.js.map +1 -1
  13. package/mysql-core/query-builders/insert.cjs +26 -0
  14. package/mysql-core/query-builders/insert.cjs.map +1 -1
  15. package/mysql-core/query-builders/insert.d.cts +26 -0
  16. package/mysql-core/query-builders/insert.d.ts +26 -0
  17. package/mysql-core/query-builders/insert.js +26 -0
  18. package/mysql-core/query-builders/insert.js.map +1 -1
  19. package/mysql-core/query-builders/query.cjs +9 -1
  20. package/mysql-core/query-builders/query.cjs.map +1 -1
  21. package/mysql-core/query-builders/query.d.cts +1 -0
  22. package/mysql-core/query-builders/query.d.ts +1 -0
  23. package/mysql-core/query-builders/query.js +9 -1
  24. package/mysql-core/query-builders/query.js.map +1 -1
  25. package/mysql-core/query-builders/select.cjs +381 -0
  26. package/mysql-core/query-builders/select.cjs.map +1 -1
  27. package/mysql-core/query-builders/select.d.cts +604 -0
  28. package/mysql-core/query-builders/select.d.ts +604 -0
  29. package/mysql-core/query-builders/select.js +381 -0
  30. package/mysql-core/query-builders/select.js.map +1 -1
  31. package/mysql-core/query-builders/update.cjs +33 -0
  32. package/mysql-core/query-builders/update.cjs.map +1 -1
  33. package/mysql-core/query-builders/update.d.cts +33 -0
  34. package/mysql-core/query-builders/update.d.ts +33 -0
  35. package/mysql-core/query-builders/update.js +33 -0
  36. package/mysql-core/query-builders/update.js.map +1 -1
  37. package/mysql-core/view.cjs +2 -2
  38. package/mysql-core/view.cjs.map +1 -1
  39. package/mysql-core/view.d.cts +1 -1
  40. package/mysql-core/view.d.ts +1 -1
  41. package/mysql-core/view.js +2 -2
  42. package/mysql-core/view.js.map +1 -1
  43. package/mysql-proxy/migrator.cjs +2 -2
  44. package/mysql-proxy/migrator.cjs.map +1 -1
  45. package/mysql-proxy/migrator.js +2 -2
  46. package/mysql-proxy/migrator.js.map +1 -1
  47. package/package.json +25 -1
  48. package/pg-core/db.cjs +153 -34
  49. package/pg-core/db.cjs.map +1 -1
  50. package/pg-core/db.d.cts +211 -0
  51. package/pg-core/db.d.ts +211 -0
  52. package/pg-core/db.js +153 -34
  53. package/pg-core/db.js.map +1 -1
  54. package/pg-core/dialect.cjs +1 -1
  55. package/pg-core/dialect.cjs.map +1 -1
  56. package/pg-core/dialect.js +1 -1
  57. package/pg-core/dialect.js.map +1 -1
  58. package/pg-core/query-builders/delete.cjs +29 -0
  59. package/pg-core/query-builders/delete.cjs.map +1 -1
  60. package/pg-core/query-builders/delete.d.cts +49 -0
  61. package/pg-core/query-builders/delete.d.ts +49 -0
  62. package/pg-core/query-builders/delete.js +29 -0
  63. package/pg-core/query-builders/delete.js.map +1 -1
  64. package/pg-core/query-builders/insert.cjs +51 -0
  65. package/pg-core/query-builders/insert.cjs.map +1 -1
  66. package/pg-core/query-builders/insert.d.cts +71 -0
  67. package/pg-core/query-builders/insert.d.ts +71 -0
  68. package/pg-core/query-builders/insert.js +51 -0
  69. package/pg-core/query-builders/insert.js.map +1 -1
  70. package/pg-core/query-builders/query.cjs +9 -2
  71. package/pg-core/query-builders/query.cjs.map +1 -1
  72. package/pg-core/query-builders/query.d.cts +1 -0
  73. package/pg-core/query-builders/query.d.ts +1 -0
  74. package/pg-core/query-builders/query.js +9 -2
  75. package/pg-core/query-builders/query.js.map +1 -1
  76. package/pg-core/query-builders/select.cjs +354 -48
  77. package/pg-core/query-builders/select.cjs.map +1 -1
  78. package/pg-core/query-builders/select.d.cts +555 -59
  79. package/pg-core/query-builders/select.d.ts +555 -59
  80. package/pg-core/query-builders/select.js +354 -48
  81. package/pg-core/query-builders/select.js.map +1 -1
  82. package/pg-core/query-builders/update.cjs +33 -0
  83. package/pg-core/query-builders/update.cjs.map +1 -1
  84. package/pg-core/query-builders/update.d.cts +55 -0
  85. package/pg-core/query-builders/update.d.ts +55 -0
  86. package/pg-core/query-builders/update.js +33 -0
  87. package/pg-core/query-builders/update.js.map +1 -1
  88. package/pg-proxy/migrator.cjs +1 -1
  89. package/pg-proxy/migrator.cjs.map +1 -1
  90. package/pg-proxy/migrator.js +1 -1
  91. package/pg-proxy/migrator.js.map +1 -1
  92. package/sql/functions/aggregate.cjs +69 -0
  93. package/sql/functions/aggregate.cjs.map +1 -0
  94. package/sql/functions/aggregate.d.cts +104 -0
  95. package/sql/functions/aggregate.d.ts +104 -0
  96. package/sql/functions/aggregate.js +38 -0
  97. package/sql/functions/aggregate.js.map +1 -0
  98. package/sql/functions/index.cjs +23 -0
  99. package/sql/functions/index.cjs.map +1 -0
  100. package/sql/functions/index.d.cts +1 -0
  101. package/sql/functions/index.d.ts +1 -0
  102. package/sql/functions/index.js +2 -0
  103. package/sql/functions/index.js.map +1 -0
  104. package/sql/index.cjs +3 -1
  105. package/sql/index.cjs.map +1 -1
  106. package/sql/index.d.cts +1 -0
  107. package/sql/index.d.ts +1 -0
  108. package/sql/index.js +1 -0
  109. package/sql/index.js.map +1 -1
  110. package/sql/sql.cjs.map +1 -1
  111. package/sql/sql.js.map +1 -1
  112. package/sqlite-core/db.cjs +155 -36
  113. package/sqlite-core/db.cjs.map +1 -1
  114. package/sqlite-core/db.d.cts +187 -0
  115. package/sqlite-core/db.d.ts +187 -0
  116. package/sqlite-core/db.js +155 -36
  117. package/sqlite-core/db.js.map +1 -1
  118. package/sqlite-core/query-builders/delete.cjs +29 -0
  119. package/sqlite-core/query-builders/delete.cjs.map +1 -1
  120. package/sqlite-core/query-builders/delete.d.cts +49 -0
  121. package/sqlite-core/query-builders/delete.d.ts +49 -0
  122. package/sqlite-core/query-builders/delete.js +29 -0
  123. package/sqlite-core/query-builders/delete.js.map +1 -1
  124. package/sqlite-core/query-builders/insert.cjs +51 -0
  125. package/sqlite-core/query-builders/insert.cjs.map +1 -1
  126. package/sqlite-core/query-builders/insert.d.cts +71 -0
  127. package/sqlite-core/query-builders/insert.d.ts +71 -0
  128. package/sqlite-core/query-builders/insert.js +51 -0
  129. package/sqlite-core/query-builders/insert.js.map +1 -1
  130. package/sqlite-core/query-builders/select.cjs +291 -0
  131. package/sqlite-core/query-builders/select.cjs.map +1 -1
  132. package/sqlite-core/query-builders/select.d.cts +434 -0
  133. package/sqlite-core/query-builders/select.d.ts +434 -0
  134. package/sqlite-core/query-builders/select.js +291 -0
  135. package/sqlite-core/query-builders/select.js.map +1 -1
  136. package/sqlite-core/query-builders/select.types.cjs.map +1 -1
  137. package/sqlite-core/query-builders/update.cjs +33 -0
  138. package/sqlite-core/query-builders/update.cjs.map +1 -1
  139. package/sqlite-core/query-builders/update.d.cts +55 -0
  140. package/sqlite-core/query-builders/update.d.ts +55 -0
  141. package/sqlite-core/query-builders/update.js +33 -0
  142. package/sqlite-core/query-builders/update.js.map +1 -1
  143. package/version.cjs +1 -1
  144. package/version.d.cts +1 -1
  145. package/version.d.ts +1 -1
  146. package/version.js +1 -1
@@ -177,32 +177,115 @@ class PgSelectQueryBuilderBase extends import_query_builder.TypedQueryBuilder {
177
177
  };
178
178
  }
179
179
  /**
180
- * For each row of the table, include
181
- * values from a matching row of the joined
182
- * table, if there is a matching row. If not,
183
- * all of the columns of the joined table
184
- * will be set to null.
180
+ * Executes a `left join` operation by adding another table to the current query.
181
+ *
182
+ * Calling this method associates each row of the table with the corresponding row from the joined table, if a match is found. If no matching row exists, it sets all columns of the joined table to null.
183
+ *
184
+ * See docs: {@link https://orm.drizzle.team/docs/joins#left-join}
185
+ *
186
+ * @param table the table to join.
187
+ * @param on the `on` clause.
188
+ *
189
+ * @example
190
+ *
191
+ * ```ts
192
+ * // Select all users and their pets
193
+ * const usersWithPets: { user: User; pets: Pet | null }[] = await db.select()
194
+ * .from(users)
195
+ * .leftJoin(pets, eq(users.id, pets.ownerId))
196
+ *
197
+ * // Select userId and petId
198
+ * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
199
+ * userId: users.id,
200
+ * petId: pets.id,
201
+ * })
202
+ * .from(users)
203
+ * .leftJoin(pets, eq(users.id, pets.ownerId))
204
+ * ```
185
205
  */
186
206
  leftJoin = this.createJoin("left");
187
207
  /**
188
- * Includes all of the rows of the joined table.
189
- * If there is no matching row in the main table,
190
- * all the columns of the main table will be
191
- * set to null.
208
+ * Executes a `right join` operation by adding another table to the current query.
209
+ *
210
+ * Calling this method associates each row of the joined table with the corresponding row from the main table, if a match is found. If no matching row exists, it sets all columns of the main table to null.
211
+ *
212
+ * See docs: {@link https://orm.drizzle.team/docs/joins#right-join}
213
+ *
214
+ * @param table the table to join.
215
+ * @param on the `on` clause.
216
+ *
217
+ * @example
218
+ *
219
+ * ```ts
220
+ * // Select all users and their pets
221
+ * const usersWithPets: { user: User | null; pets: Pet }[] = await db.select()
222
+ * .from(users)
223
+ * .rightJoin(pets, eq(users.id, pets.ownerId))
224
+ *
225
+ * // Select userId and petId
226
+ * const usersIdsAndPetIds: { userId: number | null; petId: number }[] = await db.select({
227
+ * userId: users.id,
228
+ * petId: pets.id,
229
+ * })
230
+ * .from(users)
231
+ * .rightJoin(pets, eq(users.id, pets.ownerId))
232
+ * ```
192
233
  */
193
234
  rightJoin = this.createJoin("right");
194
235
  /**
195
- * This is the default type of join.
196
- *
197
- * For each row of the table, the joined table
198
- * needs to have a matching row, or it will
199
- * be excluded from results.
236
+ * Executes an `inner join` operation, creating a new table by combining rows from two tables that have matching values.
237
+ *
238
+ * Calling this method retrieves rows that have corresponding entries in both joined tables. Rows without matching entries in either table are excluded, resulting in a table that includes only matching pairs.
239
+ *
240
+ * See docs: {@link https://orm.drizzle.team/docs/joins#inner-join}
241
+ *
242
+ * @param table the table to join.
243
+ * @param on the `on` clause.
244
+ *
245
+ * @example
246
+ *
247
+ * ```ts
248
+ * // Select all users and their pets
249
+ * const usersWithPets: { user: User; pets: Pet }[] = await db.select()
250
+ * .from(users)
251
+ * .innerJoin(pets, eq(users.id, pets.ownerId))
252
+ *
253
+ * // Select userId and petId
254
+ * const usersIdsAndPetIds: { userId: number; petId: number }[] = await db.select({
255
+ * userId: users.id,
256
+ * petId: pets.id,
257
+ * })
258
+ * .from(users)
259
+ * .innerJoin(pets, eq(users.id, pets.ownerId))
260
+ * ```
200
261
  */
201
262
  innerJoin = this.createJoin("inner");
202
263
  /**
203
- * Rows from both the main & joined are included,
204
- * regardless of whether or not they have matching
205
- * rows in the other table.
264
+ * Executes a `full join` operation by combining rows from two tables into a new table.
265
+ *
266
+ * Calling this method retrieves all rows from both main and joined tables, merging rows with matching values and filling in `null` for non-matching columns.
267
+ *
268
+ * See docs: {@link https://orm.drizzle.team/docs/joins#full-join}
269
+ *
270
+ * @param table the table to join.
271
+ * @param on the `on` clause.
272
+ *
273
+ * @example
274
+ *
275
+ * ```ts
276
+ * // Select all users and their pets
277
+ * const usersWithPets: { user: User | null; pets: Pet | null }[] = await db.select()
278
+ * .from(users)
279
+ * .fullJoin(pets, eq(users.id, pets.ownerId))
280
+ *
281
+ * // Select userId and petId
282
+ * const usersIdsAndPetIds: { userId: number | null; petId: number | null }[] = await db.select({
283
+ * userId: users.id,
284
+ * petId: pets.id,
285
+ * })
286
+ * .from(users)
287
+ * .fullJoin(pets, eq(users.id, pets.ownerId))
288
+ * ```
206
289
  */
207
290
  fullJoin = this.createJoin("full");
208
291
  createSetOperator(type, isAll) {
@@ -217,29 +300,226 @@ class PgSelectQueryBuilderBase extends import_query_builder.TypedQueryBuilder {
217
300
  return this;
218
301
  };
219
302
  }
303
+ /**
304
+ * Adds `union` set operator to the query.
305
+ *
306
+ * Calling this method will combine the result sets of the `select` statements and remove any duplicate rows that appear across them.
307
+ *
308
+ * See docs: {@link https://orm.drizzle.team/docs/set-operations#union}
309
+ *
310
+ * @example
311
+ *
312
+ * ```ts
313
+ * // Select all unique names from customers and users tables
314
+ * await db.select({ name: users.name })
315
+ * .from(users)
316
+ * .union(
317
+ * db.select({ name: customers.name }).from(customers)
318
+ * );
319
+ * // or
320
+ * import { union } from 'drizzle-orm/pg-core'
321
+ *
322
+ * await union(
323
+ * db.select({ name: users.name }).from(users),
324
+ * db.select({ name: customers.name }).from(customers)
325
+ * );
326
+ * ```
327
+ */
220
328
  union = this.createSetOperator("union", false);
329
+ /**
330
+ * Adds `union all` set operator to the query.
331
+ *
332
+ * Calling this method will combine the result-set of the `select` statements and keep all duplicate rows that appear across them.
333
+ *
334
+ * See docs: {@link https://orm.drizzle.team/docs/set-operations#union-all}
335
+ *
336
+ * @example
337
+ *
338
+ * ```ts
339
+ * // Select all transaction ids from both online and in-store sales
340
+ * await db.select({ transaction: onlineSales.transactionId })
341
+ * .from(onlineSales)
342
+ * .unionAll(
343
+ * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)
344
+ * );
345
+ * // or
346
+ * import { unionAll } from 'drizzle-orm/pg-core'
347
+ *
348
+ * await unionAll(
349
+ * db.select({ transaction: onlineSales.transactionId }).from(onlineSales),
350
+ * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)
351
+ * );
352
+ * ```
353
+ */
221
354
  unionAll = this.createSetOperator("union", true);
355
+ /**
356
+ * Adds `intersect` set operator to the query.
357
+ *
358
+ * Calling this method will retain only the rows that are present in both result sets and eliminate duplicates.
359
+ *
360
+ * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect}
361
+ *
362
+ * @example
363
+ *
364
+ * ```ts
365
+ * // Select course names that are offered in both departments A and B
366
+ * await db.select({ courseName: depA.courseName })
367
+ * .from(depA)
368
+ * .intersect(
369
+ * db.select({ courseName: depB.courseName }).from(depB)
370
+ * );
371
+ * // or
372
+ * import { intersect } from 'drizzle-orm/pg-core'
373
+ *
374
+ * await intersect(
375
+ * db.select({ courseName: depA.courseName }).from(depA),
376
+ * db.select({ courseName: depB.courseName }).from(depB)
377
+ * );
378
+ * ```
379
+ */
222
380
  intersect = this.createSetOperator("intersect", false);
381
+ /**
382
+ * Adds `intersect all` set operator to the query.
383
+ *
384
+ * Calling this method will retain only the rows that are present in both result sets including all duplicates.
385
+ *
386
+ * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect-all}
387
+ *
388
+ * @example
389
+ *
390
+ * ```ts
391
+ * // Select all products and quantities that are ordered by both regular and VIP customers
392
+ * await db.select({
393
+ * productId: regularCustomerOrders.productId,
394
+ * quantityOrdered: regularCustomerOrders.quantityOrdered
395
+ * })
396
+ * .from(regularCustomerOrders)
397
+ * .intersectAll(
398
+ * db.select({
399
+ * productId: vipCustomerOrders.productId,
400
+ * quantityOrdered: vipCustomerOrders.quantityOrdered
401
+ * })
402
+ * .from(vipCustomerOrders)
403
+ * );
404
+ * // or
405
+ * import { intersectAll } from 'drizzle-orm/pg-core'
406
+ *
407
+ * await intersectAll(
408
+ * db.select({
409
+ * productId: regularCustomerOrders.productId,
410
+ * quantityOrdered: regularCustomerOrders.quantityOrdered
411
+ * })
412
+ * .from(regularCustomerOrders),
413
+ * db.select({
414
+ * productId: vipCustomerOrders.productId,
415
+ * quantityOrdered: vipCustomerOrders.quantityOrdered
416
+ * })
417
+ * .from(vipCustomerOrders)
418
+ * );
419
+ * ```
420
+ */
223
421
  intersectAll = this.createSetOperator("intersect", true);
422
+ /**
423
+ * Adds `except` set operator to the query.
424
+ *
425
+ * Calling this method will retrieve all unique rows from the left query, except for the rows that are present in the result set of the right query.
426
+ *
427
+ * See docs: {@link https://orm.drizzle.team/docs/set-operations#except}
428
+ *
429
+ * @example
430
+ *
431
+ * ```ts
432
+ * // Select all courses offered in department A but not in department B
433
+ * await db.select({ courseName: depA.courseName })
434
+ * .from(depA)
435
+ * .except(
436
+ * db.select({ courseName: depB.courseName }).from(depB)
437
+ * );
438
+ * // or
439
+ * import { except } from 'drizzle-orm/pg-core'
440
+ *
441
+ * await except(
442
+ * db.select({ courseName: depA.courseName }).from(depA),
443
+ * db.select({ courseName: depB.courseName }).from(depB)
444
+ * );
445
+ * ```
446
+ */
224
447
  except = this.createSetOperator("except", false);
448
+ /**
449
+ * Adds `except all` set operator to the query.
450
+ *
451
+ * Calling this method will retrieve all rows from the left query, except for the rows that are present in the result set of the right query.
452
+ *
453
+ * See docs: {@link https://orm.drizzle.team/docs/set-operations#except-all}
454
+ *
455
+ * @example
456
+ *
457
+ * ```ts
458
+ * // Select all products that are ordered by regular customers but not by VIP customers
459
+ * await db.select({
460
+ * productId: regularCustomerOrders.productId,
461
+ * quantityOrdered: regularCustomerOrders.quantityOrdered,
462
+ * })
463
+ * .from(regularCustomerOrders)
464
+ * .exceptAll(
465
+ * db.select({
466
+ * productId: vipCustomerOrders.productId,
467
+ * quantityOrdered: vipCustomerOrders.quantityOrdered,
468
+ * })
469
+ * .from(vipCustomerOrders)
470
+ * );
471
+ * // or
472
+ * import { exceptAll } from 'drizzle-orm/pg-core'
473
+ *
474
+ * await exceptAll(
475
+ * db.select({
476
+ * productId: regularCustomerOrders.productId,
477
+ * quantityOrdered: regularCustomerOrders.quantityOrdered
478
+ * })
479
+ * .from(regularCustomerOrders),
480
+ * db.select({
481
+ * productId: vipCustomerOrders.productId,
482
+ * quantityOrdered: vipCustomerOrders.quantityOrdered
483
+ * })
484
+ * .from(vipCustomerOrders)
485
+ * );
486
+ * ```
487
+ */
225
488
  exceptAll = this.createSetOperator("except", true);
226
489
  /** @internal */
227
490
  addSetOperators(setOperators) {
228
491
  this.config.setOperators.push(...setOperators);
229
492
  return this;
230
493
  }
231
- /**
232
- * Specify a condition to narrow the result set. Multiple
233
- * conditions can be combined with the `and` and `or`
234
- * functions.
235
- *
236
- * ## Examples
237
- *
494
+ /**
495
+ * Adds a `where` clause to the query.
496
+ *
497
+ * Calling this method will select only those rows that fulfill a specified condition.
498
+ *
499
+ * See docs: {@link https://orm.drizzle.team/docs/select#filtering}
500
+ *
501
+ * @param where the `where` clause.
502
+ *
503
+ * @example
504
+ * You can use conditional operators and `sql function` to filter the rows to be selected.
505
+ *
238
506
  * ```ts
239
- * // Find cars made in the year 2000
240
- * db.select().from(cars).where(eq(cars.year, 2000));
507
+ * // Select all cars with green color
508
+ * await db.select().from(cars).where(eq(cars.color, 'green'));
509
+ * // or
510
+ * await db.select().from(cars).where(sql`${cars.color} = 'green'`)
241
511
  * ```
242
- */
512
+ *
513
+ * You can logically combine conditional operators with `and()` and `or()` operators:
514
+ *
515
+ * ```ts
516
+ * // Select all BMW cars with a green color
517
+ * await db.select().from(cars).where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));
518
+ *
519
+ * // Select all cars with the green or blue color
520
+ * await db.select().from(cars).where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));
521
+ * ```
522
+ */
243
523
  where(where) {
244
524
  if (typeof where === "function") {
245
525
  where = where(
@@ -253,11 +533,26 @@ class PgSelectQueryBuilderBase extends import_query_builder.TypedQueryBuilder {
253
533
  return this;
254
534
  }
255
535
  /**
256
- * Sets the HAVING clause of this query, which often
257
- * used with GROUP BY and filters rows after they've been
258
- * grouped together and combined.
259
- *
260
- * {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-HAVING | Postgres having clause documentation}
536
+ * Adds a `having` clause to the query.
537
+ *
538
+ * Calling this method will select only those rows that fulfill a specified condition. It is typically used with aggregate functions to filter the aggregated data based on a specified condition.
539
+ *
540
+ * See docs: {@link https://orm.drizzle.team/docs/select#aggregations}
541
+ *
542
+ * @param having the `having` clause.
543
+ *
544
+ * @example
545
+ *
546
+ * ```ts
547
+ * // Select all brands with more than one car
548
+ * await db.select({
549
+ * brand: cars.brand,
550
+ * count: sql<number>`cast(count(${cars.id}) as int)`,
551
+ * })
552
+ * .from(cars)
553
+ * .groupBy(cars.brand)
554
+ * .having(({ count }) => gt(count, 1));
555
+ * ```
261
556
  */
262
557
  having(having) {
263
558
  if (typeof having === "function") {
@@ -310,17 +605,20 @@ class PgSelectQueryBuilderBase extends import_query_builder.TypedQueryBuilder {
310
605
  return this;
311
606
  }
312
607
  /**
313
- * Set the maximum number of rows that will be
314
- * returned by this query.
608
+ * Adds a `limit` clause to the query.
609
+ *
610
+ * Calling this method will set the maximum number of rows that will be returned by this query.
315
611
  *
316
- * ## Examples
612
+ * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset}
613
+ *
614
+ * @param limit the `limit` clause.
615
+ *
616
+ * @example
317
617
  *
318
618
  * ```ts
319
619
  * // Get the first 10 people from this query.
320
- * db.select().from(people).limit(10);
620
+ * await db.select().from(people).limit(10);
321
621
  * ```
322
- *
323
- * {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-LIMIT | Postgres LIMIT documentation}
324
622
  */
325
623
  limit(limit) {
326
624
  if (this.config.setOperators.length > 0) {
@@ -331,14 +629,19 @@ class PgSelectQueryBuilderBase extends import_query_builder.TypedQueryBuilder {
331
629
  return this;
332
630
  }
333
631
  /**
334
- * Skip a number of rows when returning results
335
- * from this query.
336
- *
337
- * ## Examples
632
+ * Adds an `offset` clause to the query.
633
+ *
634
+ * Calling this method will skip a number of rows when returning results from this query.
635
+ *
636
+ * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset}
637
+ *
638
+ * @param offset the `offset` clause.
639
+ *
640
+ * @example
338
641
  *
339
642
  * ```ts
340
643
  * // Get the 10th-20th people from this query.
341
- * db.select().from(people).offset(10).limit(10);
644
+ * await db.select().from(people).offset(10).limit(10);
342
645
  * ```
343
646
  */
344
647
  offset(offset) {
@@ -350,11 +653,14 @@ class PgSelectQueryBuilderBase extends import_query_builder.TypedQueryBuilder {
350
653
  return this;
351
654
  }
352
655
  /**
353
- * The FOR clause specifies a lock strength for this query
354
- * that controls how strictly it acquires exclusive access to
355
- * the rows being queried.
356
- *
357
- * {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FOR-UPDATE-SHARE | PostgreSQL locking clause documentation}
656
+ * Adds a `for` clause to the query.
657
+ *
658
+ * Calling this method will specify a lock strength for this query that controls how strictly it acquires exclusive access to the rows being queried.
659
+ *
660
+ * See docs: {@link https://www.postgresql.org/docs/current/sql-select.html#SQL-FOR-UPDATE-SHARE}
661
+ *
662
+ * @param strength the lock strength.
663
+ * @param config the lock configuration.
358
664
  */
359
665
  for(strength, config = {}) {
360
666
  this.config.lockingClause = { strength, config };