drizzle-orm 0.29.0 → 0.29.1-d55aea4

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
@@ -61,22 +61,356 @@ export declare abstract class SQLiteSelectQueryBuilderBase<THKT extends SQLiteSe
61
61
  distinct: boolean | undefined;
62
62
  });
63
63
  private createJoin;
64
+ /**
65
+ * Executes a `left join` operation by adding another table to the current query.
66
+ *
67
+ * 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.
68
+ *
69
+ * See docs: {@link https://orm.drizzle.team/docs/joins#left-join}
70
+ *
71
+ * @param table the table to join.
72
+ * @param on the `on` clause.
73
+ *
74
+ * @example
75
+ *
76
+ * ```ts
77
+ * // Select all users and their pets
78
+ * const usersWithPets: { user: User; pets: Pet | null }[] = await db.select()
79
+ * .from(users)
80
+ * .leftJoin(pets, eq(users.id, pets.ownerId))
81
+ *
82
+ * // Select userId and petId
83
+ * const usersIdsAndPetIds: { userId: number; petId: number | null }[] = await db.select({
84
+ * userId: users.id,
85
+ * petId: pets.id,
86
+ * })
87
+ * .from(users)
88
+ * .leftJoin(pets, eq(users.id, pets.ownerId))
89
+ * ```
90
+ */
64
91
  leftJoin: SQLiteJoinFn<this, TDynamic, "left">;
92
+ /**
93
+ * Executes a `right join` operation by adding another table to the current query.
94
+ *
95
+ * 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.
96
+ *
97
+ * See docs: {@link https://orm.drizzle.team/docs/joins#right-join}
98
+ *
99
+ * @param table the table to join.
100
+ * @param on the `on` clause.
101
+ *
102
+ * @example
103
+ *
104
+ * ```ts
105
+ * // Select all users and their pets
106
+ * const usersWithPets: { user: User | null; pets: Pet }[] = await db.select()
107
+ * .from(users)
108
+ * .rightJoin(pets, eq(users.id, pets.ownerId))
109
+ *
110
+ * // Select userId and petId
111
+ * const usersIdsAndPetIds: { userId: number | null; petId: number }[] = await db.select({
112
+ * userId: users.id,
113
+ * petId: pets.id,
114
+ * })
115
+ * .from(users)
116
+ * .rightJoin(pets, eq(users.id, pets.ownerId))
117
+ * ```
118
+ */
65
119
  rightJoin: SQLiteJoinFn<this, TDynamic, "right">;
120
+ /**
121
+ * Executes an `inner join` operation, creating a new table by combining rows from two tables that have matching values.
122
+ *
123
+ * 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.
124
+ *
125
+ * See docs: {@link https://orm.drizzle.team/docs/joins#inner-join}
126
+ *
127
+ * @param table the table to join.
128
+ * @param on the `on` clause.
129
+ *
130
+ * @example
131
+ *
132
+ * ```ts
133
+ * // Select all users and their pets
134
+ * const usersWithPets: { user: User; pets: Pet }[] = await db.select()
135
+ * .from(users)
136
+ * .innerJoin(pets, eq(users.id, pets.ownerId))
137
+ *
138
+ * // Select userId and petId
139
+ * const usersIdsAndPetIds: { userId: number; petId: number }[] = await db.select({
140
+ * userId: users.id,
141
+ * petId: pets.id,
142
+ * })
143
+ * .from(users)
144
+ * .innerJoin(pets, eq(users.id, pets.ownerId))
145
+ * ```
146
+ */
66
147
  innerJoin: SQLiteJoinFn<this, TDynamic, "inner">;
148
+ /**
149
+ * Executes a `full join` operation by combining rows from two tables into a new table.
150
+ *
151
+ * 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.
152
+ *
153
+ * See docs: {@link https://orm.drizzle.team/docs/joins#full-join}
154
+ *
155
+ * @param table the table to join.
156
+ * @param on the `on` clause.
157
+ *
158
+ * @example
159
+ *
160
+ * ```ts
161
+ * // Select all users and their pets
162
+ * const usersWithPets: { user: User | null; pets: Pet | null }[] = await db.select()
163
+ * .from(users)
164
+ * .fullJoin(pets, eq(users.id, pets.ownerId))
165
+ *
166
+ * // Select userId and petId
167
+ * const usersIdsAndPetIds: { userId: number | null; petId: number | null }[] = await db.select({
168
+ * userId: users.id,
169
+ * petId: pets.id,
170
+ * })
171
+ * .from(users)
172
+ * .fullJoin(pets, eq(users.id, pets.ownerId))
173
+ * ```
174
+ */
67
175
  fullJoin: SQLiteJoinFn<this, TDynamic, "full">;
68
176
  private createSetOperator;
177
+ /**
178
+ * Adds `union` set operator to the query.
179
+ *
180
+ * Calling this method will combine the result sets of the `select` statements and remove any duplicate rows that appear across them.
181
+ *
182
+ * See docs: {@link https://orm.drizzle.team/docs/set-operations#union}
183
+ *
184
+ * @example
185
+ *
186
+ * ```ts
187
+ * // Select all unique names from customers and users tables
188
+ * await db.select({ name: users.name })
189
+ * .from(users)
190
+ * .union(
191
+ * db.select({ name: customers.name }).from(customers)
192
+ * );
193
+ * // or
194
+ * import { union } from 'drizzle-orm/sqlite-core'
195
+ *
196
+ * await union(
197
+ * db.select({ name: users.name }).from(users),
198
+ * db.select({ name: customers.name }).from(customers)
199
+ * );
200
+ * ```
201
+ */
69
202
  union: <TValue extends SQLiteSetOperatorWithResult<TResult>>(rightSelection: ((setOperators: GetSQLiteSetOperators) => SetOperatorRightSelect<TValue, TResult>) | SetOperatorRightSelect<TValue, TResult>) => SQLiteSelectWithout<this, TDynamic, SQLiteSetOperatorExcludedMethods, true>;
203
+ /**
204
+ * Adds `union all` set operator to the query.
205
+ *
206
+ * Calling this method will combine the result-set of the `select` statements and keep all duplicate rows that appear across them.
207
+ *
208
+ * See docs: {@link https://orm.drizzle.team/docs/set-operations#union-all}
209
+ *
210
+ * @example
211
+ *
212
+ * ```ts
213
+ * // Select all transaction ids from both online and in-store sales
214
+ * await db.select({ transaction: onlineSales.transactionId })
215
+ * .from(onlineSales)
216
+ * .unionAll(
217
+ * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)
218
+ * );
219
+ * // or
220
+ * import { unionAll } from 'drizzle-orm/sqlite-core'
221
+ *
222
+ * await unionAll(
223
+ * db.select({ transaction: onlineSales.transactionId }).from(onlineSales),
224
+ * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)
225
+ * );
226
+ * ```
227
+ */
70
228
  unionAll: <TValue extends SQLiteSetOperatorWithResult<TResult>>(rightSelection: ((setOperators: GetSQLiteSetOperators) => SetOperatorRightSelect<TValue, TResult>) | SetOperatorRightSelect<TValue, TResult>) => SQLiteSelectWithout<this, TDynamic, SQLiteSetOperatorExcludedMethods, true>;
229
+ /**
230
+ * Adds `intersect` set operator to the query.
231
+ *
232
+ * Calling this method will retain only the rows that are present in both result sets and eliminate duplicates.
233
+ *
234
+ * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect}
235
+ *
236
+ * @example
237
+ *
238
+ * ```ts
239
+ * // Select course names that are offered in both departments A and B
240
+ * await db.select({ courseName: depA.courseName })
241
+ * .from(depA)
242
+ * .intersect(
243
+ * db.select({ courseName: depB.courseName }).from(depB)
244
+ * );
245
+ * // or
246
+ * import { intersect } from 'drizzle-orm/sqlite-core'
247
+ *
248
+ * await intersect(
249
+ * db.select({ courseName: depA.courseName }).from(depA),
250
+ * db.select({ courseName: depB.courseName }).from(depB)
251
+ * );
252
+ * ```
253
+ */
71
254
  intersect: <TValue extends SQLiteSetOperatorWithResult<TResult>>(rightSelection: ((setOperators: GetSQLiteSetOperators) => SetOperatorRightSelect<TValue, TResult>) | SetOperatorRightSelect<TValue, TResult>) => SQLiteSelectWithout<this, TDynamic, SQLiteSetOperatorExcludedMethods, true>;
255
+ /**
256
+ * Adds `except` set operator to the query.
257
+ *
258
+ * 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.
259
+ *
260
+ * See docs: {@link https://orm.drizzle.team/docs/set-operations#except}
261
+ *
262
+ * @example
263
+ *
264
+ * ```ts
265
+ * // Select all courses offered in department A but not in department B
266
+ * await db.select({ courseName: depA.courseName })
267
+ * .from(depA)
268
+ * .except(
269
+ * db.select({ courseName: depB.courseName }).from(depB)
270
+ * );
271
+ * // or
272
+ * import { except } from 'drizzle-orm/sqlite-core'
273
+ *
274
+ * await except(
275
+ * db.select({ courseName: depA.courseName }).from(depA),
276
+ * db.select({ courseName: depB.courseName }).from(depB)
277
+ * );
278
+ * ```
279
+ */
72
280
  except: <TValue extends SQLiteSetOperatorWithResult<TResult>>(rightSelection: ((setOperators: GetSQLiteSetOperators) => SetOperatorRightSelect<TValue, TResult>) | SetOperatorRightSelect<TValue, TResult>) => SQLiteSelectWithout<this, TDynamic, SQLiteSetOperatorExcludedMethods, true>;
281
+ /**
282
+ * Adds a `where` clause to the query.
283
+ *
284
+ * Calling this method will select only those rows that fulfill a specified condition.
285
+ *
286
+ * See docs: {@link https://orm.drizzle.team/docs/select#filtering}
287
+ *
288
+ * @param where the `where` clause.
289
+ *
290
+ * @example
291
+ * You can use conditional operators and `sql function` to filter the rows to be selected.
292
+ *
293
+ * ```ts
294
+ * // Select all cars with green color
295
+ * await db.select().from(cars).where(eq(cars.color, 'green'));
296
+ * // or
297
+ * await db.select().from(cars).where(sql`${cars.color} = 'green'`)
298
+ * ```
299
+ *
300
+ * You can logically combine conditional operators with `and()` and `or()` operators:
301
+ *
302
+ * ```ts
303
+ * // Select all BMW cars with a green color
304
+ * await db.select().from(cars).where(and(eq(cars.color, 'green'), eq(cars.brand, 'BMW')));
305
+ *
306
+ * // Select all cars with the green or blue color
307
+ * await db.select().from(cars).where(or(eq(cars.color, 'green'), eq(cars.color, 'blue')));
308
+ * ```
309
+ */
73
310
  where(where: ((aliases: TSelection) => SQL | undefined) | SQL | undefined): SQLiteSelectWithout<this, TDynamic, 'where'>;
311
+ /**
312
+ * Adds a `having` clause to the query.
313
+ *
314
+ * 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.
315
+ *
316
+ * See docs: {@link https://orm.drizzle.team/docs/select#aggregations}
317
+ *
318
+ * @param having the `having` clause.
319
+ *
320
+ * @example
321
+ *
322
+ * ```ts
323
+ * // Select all brands with more than one car
324
+ * await db.select({
325
+ * brand: cars.brand,
326
+ * count: sql<number>`cast(count(${cars.id}) as int)`,
327
+ * })
328
+ * .from(cars)
329
+ * .groupBy(cars.brand)
330
+ * .having(({ count }) => gt(count, 1));
331
+ * ```
332
+ */
74
333
  having(having: ((aliases: this['_']['selection']) => SQL | undefined) | SQL | undefined): SQLiteSelectWithout<this, TDynamic, 'having'>;
334
+ /**
335
+ * Adds a `group by` clause to the query.
336
+ *
337
+ * Calling this method will group rows that have the same values into summary rows, often used for aggregation purposes.
338
+ *
339
+ * See docs: {@link https://orm.drizzle.team/docs/select#aggregations}
340
+ *
341
+ * @example
342
+ *
343
+ * ```ts
344
+ * // Group and count people by their last names
345
+ * await db.select({
346
+ * lastName: people.lastName,
347
+ * count: sql<number>`cast(count(*) as int)`
348
+ * })
349
+ * .from(people)
350
+ * .groupBy(people.lastName);
351
+ * ```
352
+ */
75
353
  groupBy(builder: (aliases: this['_']['selection']) => ValueOrArray<SQLiteColumn | SQL | SQL.Aliased>): SQLiteSelectWithout<this, TDynamic, 'groupBy'>;
76
354
  groupBy(...columns: (SQLiteColumn | SQL)[]): SQLiteSelectWithout<this, TDynamic, 'groupBy'>;
355
+ /**
356
+ * Adds an `order by` clause to the query.
357
+ *
358
+ * Calling this method will sort the result-set in ascending or descending order. By default, the sort order is ascending.
359
+ *
360
+ * See docs: {@link https://orm.drizzle.team/docs/select#order-by}
361
+ *
362
+ * @example
363
+ *
364
+ * ```
365
+ * // Select cars ordered by year
366
+ * await db.select().from(cars).orderBy(cars.year);
367
+ * ```
368
+ *
369
+ * You can specify whether results are in ascending or descending order with the `asc()` and `desc()` operators.
370
+ *
371
+ * ```ts
372
+ * // Select cars ordered by year in descending order
373
+ * await db.select().from(cars).orderBy(desc(cars.year));
374
+ *
375
+ * // Select cars ordered by year and price
376
+ * await db.select().from(cars).orderBy(asc(cars.year), desc(cars.price));
377
+ * ```
378
+ */
77
379
  orderBy(builder: (aliases: this['_']['selection']) => ValueOrArray<SQLiteColumn | SQL | SQL.Aliased>): SQLiteSelectWithout<this, TDynamic, 'orderBy'>;
78
380
  orderBy(...columns: (SQLiteColumn | SQL)[]): SQLiteSelectWithout<this, TDynamic, 'orderBy'>;
381
+ /**
382
+ * Adds a `limit` clause to the query.
383
+ *
384
+ * Calling this method will set the maximum number of rows that will be returned by this query.
385
+ *
386
+ * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset}
387
+ *
388
+ * @param limit the `limit` clause.
389
+ *
390
+ * @example
391
+ *
392
+ * ```ts
393
+ * // Get the first 10 people from this query.
394
+ * await db.select().from(people).limit(10);
395
+ * ```
396
+ */
79
397
  limit(limit: number | Placeholder): SQLiteSelectWithout<this, TDynamic, 'limit'>;
398
+ /**
399
+ * Adds an `offset` clause to the query.
400
+ *
401
+ * Calling this method will skip a number of rows when returning results from this query.
402
+ *
403
+ * See docs: {@link https://orm.drizzle.team/docs/select#limit--offset}
404
+ *
405
+ * @param offset the `offset` clause.
406
+ *
407
+ * @example
408
+ *
409
+ * ```ts
410
+ * // Get the 10th-20th people from this query.
411
+ * await db.select().from(people).offset(10).limit(10);
412
+ * ```
413
+ */
80
414
  offset(offset: number | Placeholder): SQLiteSelectWithout<this, TDynamic, 'offset'>;
81
415
  toSQL(): Query;
82
416
  as<TAlias extends string>(alias: TAlias): SubqueryWithSelection<this['_']['selectedFields'], TAlias>;
@@ -93,7 +427,107 @@ export declare class SQLiteSelectBase<TTableName extends string | undefined, TRe
93
427
  values: ReturnType<this['prepare']>['values'];
94
428
  execute(): Promise<SQLiteSelectExecute<this>>;
95
429
  }
430
+ /**
431
+ * Adds `union` set operator to the query.
432
+ *
433
+ * Calling this method will combine the result sets of the `select` statements and remove any duplicate rows that appear across them.
434
+ *
435
+ * See docs: {@link https://orm.drizzle.team/docs/set-operations#union}
436
+ *
437
+ * @example
438
+ *
439
+ * ```ts
440
+ * // Select all unique names from customers and users tables
441
+ * import { union } from 'drizzle-orm/sqlite-core'
442
+ *
443
+ * await union(
444
+ * db.select({ name: users.name }).from(users),
445
+ * db.select({ name: customers.name }).from(customers)
446
+ * );
447
+ * // or
448
+ * await db.select({ name: users.name })
449
+ * .from(users)
450
+ * .union(
451
+ * db.select({ name: customers.name }).from(customers)
452
+ * );
453
+ * ```
454
+ */
96
455
  export declare const union: SQLiteCreateSetOperatorFn;
456
+ /**
457
+ * Adds `union all` set operator to the query.
458
+ *
459
+ * Calling this method will combine the result-set of the `select` statements and keep all duplicate rows that appear across them.
460
+ *
461
+ * See docs: {@link https://orm.drizzle.team/docs/set-operations#union-all}
462
+ *
463
+ * @example
464
+ *
465
+ * ```ts
466
+ * // Select all transaction ids from both online and in-store sales
467
+ * import { unionAll } from 'drizzle-orm/sqlite-core'
468
+ *
469
+ * await unionAll(
470
+ * db.select({ transaction: onlineSales.transactionId }).from(onlineSales),
471
+ * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)
472
+ * );
473
+ * // or
474
+ * await db.select({ transaction: onlineSales.transactionId })
475
+ * .from(onlineSales)
476
+ * .unionAll(
477
+ * db.select({ transaction: inStoreSales.transactionId }).from(inStoreSales)
478
+ * );
479
+ * ```
480
+ */
97
481
  export declare const unionAll: SQLiteCreateSetOperatorFn;
482
+ /**
483
+ * Adds `intersect` set operator to the query.
484
+ *
485
+ * Calling this method will retain only the rows that are present in both result sets and eliminate duplicates.
486
+ *
487
+ * See docs: {@link https://orm.drizzle.team/docs/set-operations#intersect}
488
+ *
489
+ * @example
490
+ *
491
+ * ```ts
492
+ * // Select course names that are offered in both departments A and B
493
+ * import { intersect } from 'drizzle-orm/sqlite-core'
494
+ *
495
+ * await intersect(
496
+ * db.select({ courseName: depA.courseName }).from(depA),
497
+ * db.select({ courseName: depB.courseName }).from(depB)
498
+ * );
499
+ * // or
500
+ * await db.select({ courseName: depA.courseName })
501
+ * .from(depA)
502
+ * .intersect(
503
+ * db.select({ courseName: depB.courseName }).from(depB)
504
+ * );
505
+ * ```
506
+ */
98
507
  export declare const intersect: SQLiteCreateSetOperatorFn;
508
+ /**
509
+ * Adds `except` set operator to the query.
510
+ *
511
+ * 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.
512
+ *
513
+ * See docs: {@link https://orm.drizzle.team/docs/set-operations#except}
514
+ *
515
+ * @example
516
+ *
517
+ * ```ts
518
+ * // Select all courses offered in department A but not in department B
519
+ * import { except } from 'drizzle-orm/sqlite-core'
520
+ *
521
+ * await except(
522
+ * db.select({ courseName: depA.courseName }).from(depA),
523
+ * db.select({ courseName: depB.courseName }).from(depB)
524
+ * );
525
+ * // or
526
+ * await db.select({ courseName: depA.courseName })
527
+ * .from(depA)
528
+ * .except(
529
+ * db.select({ courseName: depB.courseName }).from(depB)
530
+ * );
531
+ * ```
532
+ */
99
533
  export declare const except: SQLiteCreateSetOperatorFn;