drizzle-orm 0.24.0 → 0.24.1-9e5876f
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.
- package/package.json +1 -1
- package/sql/expressions/conditions.d.ts +356 -0
- package/sql/expressions/conditions.d.ts.map +1 -1
- package/sql/expressions/conditions.js +187 -0
- package/sql/expressions/conditions.js.map +1 -1
- package/sql/expressions/select.d.ts +34 -0
- package/sql/expressions/select.d.ts.map +1 -1
- package/sql/expressions/select.js +34 -0
- package/sql/expressions/select.js.map +1 -1
- package/sqlite-core/query-builders/insert.js +2 -2
- package/sqlite-core/query-builders/insert.js.map +1 -1
package/package.json
CHANGED
|
@@ -1,35 +1,391 @@
|
|
|
1
1
|
import { type AnyColumn, type GetColumnData } from '../../column';
|
|
2
2
|
import { Placeholder, type SQL, type SQLChunk, type SQLWrapper } from '../index';
|
|
3
3
|
export declare function bindIfParam(value: unknown, column: AnyColumn | SQL.Aliased): SQLChunk;
|
|
4
|
+
/**
|
|
5
|
+
* Test that two values are equal.
|
|
6
|
+
*
|
|
7
|
+
* Remember that the SQL standard dictates that
|
|
8
|
+
* two NULL values are not equal, so if you want to test
|
|
9
|
+
* whether a value is null, you may want to use
|
|
10
|
+
* `isNull` instead.
|
|
11
|
+
*
|
|
12
|
+
* ## Examples
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* // Select cars made by Ford
|
|
16
|
+
* db.select(cars)
|
|
17
|
+
* .where(eq(cars.make, 'Ford'))
|
|
18
|
+
* ```
|
|
19
|
+
*
|
|
20
|
+
* @see isNull for a way to test equality to NULL.
|
|
21
|
+
*/
|
|
4
22
|
export declare function eq<T>(left: SQL.Aliased<T>, right: T | Placeholder | SQLWrapper | AnyColumn): SQL;
|
|
5
23
|
export declare function eq<TColumn extends AnyColumn>(left: TColumn, right: GetColumnData<TColumn, 'raw'> | Placeholder | SQLWrapper | AnyColumn): SQL;
|
|
24
|
+
/**
|
|
25
|
+
* Test that two values are not equal.
|
|
26
|
+
*
|
|
27
|
+
* Remember that the SQL standard dictates that
|
|
28
|
+
* two NULL values are not equal, so if you want to test
|
|
29
|
+
* whether a value is not null, you may want to use
|
|
30
|
+
* `isNotNull` instead.
|
|
31
|
+
*
|
|
32
|
+
* ## Examples
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* // Select cars not made by Ford
|
|
36
|
+
* db.select(cars)
|
|
37
|
+
* .where(ne(cars.make, 'Ford'))
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @see isNotNull for a way to test whether a value is not null.
|
|
41
|
+
*/
|
|
6
42
|
export declare function ne<T>(left: SQL.Aliased<T>, right: T | Placeholder | SQLWrapper | AnyColumn): SQL;
|
|
7
43
|
export declare function ne<TColumn extends AnyColumn>(left: TColumn, right: GetColumnData<TColumn, 'raw'> | Placeholder | SQLWrapper | AnyColumn): SQL;
|
|
44
|
+
/**
|
|
45
|
+
* Combine a list of conditions with the `and` operator. Conditions
|
|
46
|
+
* that are equal `undefined` are automatically ignored.
|
|
47
|
+
*
|
|
48
|
+
* ## Examples
|
|
49
|
+
*
|
|
50
|
+
* ```ts
|
|
51
|
+
* db.select(cars)
|
|
52
|
+
* .where(
|
|
53
|
+
* and(
|
|
54
|
+
* eq(cars.make, 'Volvo'),
|
|
55
|
+
* eq(cars.year, 1950),
|
|
56
|
+
* )
|
|
57
|
+
* )
|
|
58
|
+
* ```
|
|
59
|
+
*/
|
|
8
60
|
export declare function and(...conditions: (SQL | undefined)[]): SQL | undefined;
|
|
61
|
+
/**
|
|
62
|
+
* Combine a list of conditions with the `or` operator. Conditions
|
|
63
|
+
* that are equal `undefined` are automatically ignored.
|
|
64
|
+
*
|
|
65
|
+
* ## Examples
|
|
66
|
+
*
|
|
67
|
+
* ```ts
|
|
68
|
+
* db.select(cars)
|
|
69
|
+
* .where(
|
|
70
|
+
* or(
|
|
71
|
+
* eq(cars.make, 'GM'),
|
|
72
|
+
* eq(cars.make, 'Ford'),
|
|
73
|
+
* )
|
|
74
|
+
* )
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
9
77
|
export declare function or(...conditions: (SQL | undefined)[]): SQL | undefined;
|
|
78
|
+
/**
|
|
79
|
+
* Negate the meaning of an expression using the `not` keyword.
|
|
80
|
+
*
|
|
81
|
+
* ## Examples
|
|
82
|
+
*
|
|
83
|
+
* ```ts
|
|
84
|
+
* // Select cars _not_ made by GM or Ford.
|
|
85
|
+
* db.select(cars)
|
|
86
|
+
* .where(not(inArray(cars.make, ['GM', 'Ford'])))
|
|
87
|
+
* ```
|
|
88
|
+
*/
|
|
10
89
|
export declare function not(condition: SQL): SQL;
|
|
90
|
+
/**
|
|
91
|
+
* Test that the first expression passed is greater than
|
|
92
|
+
* the second expression.
|
|
93
|
+
*
|
|
94
|
+
* ## Examples
|
|
95
|
+
*
|
|
96
|
+
* ```ts
|
|
97
|
+
* // Select cars made after 2000.
|
|
98
|
+
* db.select(cars)
|
|
99
|
+
* .where(gt(cars.year, 2000))
|
|
100
|
+
* ```
|
|
101
|
+
*
|
|
102
|
+
* @see gte for greater-than-or-equal
|
|
103
|
+
*/
|
|
11
104
|
export declare function gt<T>(left: SQL.Aliased<T>, right: T | Placeholder | SQLWrapper | AnyColumn): SQL;
|
|
12
105
|
export declare function gt<TColumn extends AnyColumn>(left: TColumn, right: GetColumnData<TColumn, 'raw'> | Placeholder | SQLWrapper | AnyColumn): SQL;
|
|
106
|
+
/**
|
|
107
|
+
* Test that the first expression passed is greater than
|
|
108
|
+
* or equal to the second expression. Use `gt` to
|
|
109
|
+
* test whether an expression is strictly greater
|
|
110
|
+
* than another.
|
|
111
|
+
*
|
|
112
|
+
* ## Examples
|
|
113
|
+
*
|
|
114
|
+
* ```ts
|
|
115
|
+
* // Select cars made on or after 2000.
|
|
116
|
+
* db.select(cars)
|
|
117
|
+
* .where(gte(cars.year, 2000))
|
|
118
|
+
* ```
|
|
119
|
+
*
|
|
120
|
+
* @see gt for a strictly greater-than condition
|
|
121
|
+
*/
|
|
13
122
|
export declare function gte<T>(left: SQL.Aliased<T>, right: T | Placeholder | SQLWrapper | AnyColumn): SQL;
|
|
14
123
|
export declare function gte<TColumn extends AnyColumn>(left: TColumn, right: GetColumnData<TColumn, 'raw'> | Placeholder | SQLWrapper | AnyColumn): SQL;
|
|
124
|
+
/**
|
|
125
|
+
* Test that the first expression passed is less than
|
|
126
|
+
* the second expression.
|
|
127
|
+
*
|
|
128
|
+
* ## Examples
|
|
129
|
+
*
|
|
130
|
+
* ```ts
|
|
131
|
+
* // Select cars made before 2000.
|
|
132
|
+
* db.select(cars)
|
|
133
|
+
* .where(lt(cars.year, 2000))
|
|
134
|
+
* ```
|
|
135
|
+
*
|
|
136
|
+
* @see lte for greater-than-or-equal
|
|
137
|
+
*/
|
|
15
138
|
export declare function lt<T>(left: SQL.Aliased<T>, right: T | Placeholder | SQLWrapper | AnyColumn): SQL;
|
|
16
139
|
export declare function lt<TColumn extends AnyColumn>(left: TColumn, right: GetColumnData<TColumn, 'raw'> | Placeholder | SQLWrapper | AnyColumn): SQL;
|
|
140
|
+
/**
|
|
141
|
+
* Test that the first expression passed is less than
|
|
142
|
+
* or equal to the second expression.
|
|
143
|
+
*
|
|
144
|
+
* ## Examples
|
|
145
|
+
*
|
|
146
|
+
* ```ts
|
|
147
|
+
* // Select cars made before 2000.
|
|
148
|
+
* db.select(cars)
|
|
149
|
+
* .where(lte(cars.year, 2000))
|
|
150
|
+
* ```
|
|
151
|
+
*
|
|
152
|
+
* @see lt for a strictly less-than condition
|
|
153
|
+
*/
|
|
17
154
|
export declare function lte<T>(left: SQL.Aliased<T>, right: T | Placeholder | SQLWrapper | AnyColumn): SQL;
|
|
18
155
|
export declare function lte<TColumn extends AnyColumn>(left: TColumn, right: GetColumnData<TColumn, 'raw'> | Placeholder | SQLWrapper | AnyColumn): SQL;
|
|
156
|
+
/**
|
|
157
|
+
* Test whether the first parameter, a column or expression,
|
|
158
|
+
* has a value from a list passed as the second argument.
|
|
159
|
+
*
|
|
160
|
+
* ## Throws
|
|
161
|
+
*
|
|
162
|
+
* The argument passed in the second array can’t be empty:
|
|
163
|
+
* if an empty is provided, this method will throw.
|
|
164
|
+
*
|
|
165
|
+
* ## Examples
|
|
166
|
+
*
|
|
167
|
+
* ```ts
|
|
168
|
+
* // Select cars made by Ford or GM.
|
|
169
|
+
* db.select(cars)
|
|
170
|
+
* .where(inArray(cars.make, ['Ford', 'GM']))
|
|
171
|
+
* ```
|
|
172
|
+
*
|
|
173
|
+
* @see notInArray for the inverse of this test
|
|
174
|
+
*/
|
|
19
175
|
export declare function inArray<T>(column: SQL.Aliased<T>, values: (T | Placeholder)[] | Placeholder | SQLWrapper): SQL;
|
|
20
176
|
export declare function inArray<TColumn extends AnyColumn>(column: TColumn, values: (GetColumnData<TColumn, 'raw'> | Placeholder)[] | Placeholder | SQLWrapper): SQL;
|
|
177
|
+
/**
|
|
178
|
+
* Test whether the first parameter, a column or expression,
|
|
179
|
+
* has a value that is not present in a list passed as the
|
|
180
|
+
* second argument.
|
|
181
|
+
*
|
|
182
|
+
* ## Throws
|
|
183
|
+
*
|
|
184
|
+
* The argument passed in the second array can’t be empty:
|
|
185
|
+
* if an empty is provided, this method will throw.
|
|
186
|
+
*
|
|
187
|
+
* ## Examples
|
|
188
|
+
*
|
|
189
|
+
* ```ts
|
|
190
|
+
* // Select cars made by any company except Ford or GM.
|
|
191
|
+
* db.select(cars)
|
|
192
|
+
* .where(notInArray(cars.make, ['Ford', 'GM']))
|
|
193
|
+
* ```
|
|
194
|
+
*
|
|
195
|
+
* @see inArray for the inverse of this test
|
|
196
|
+
*/
|
|
21
197
|
export declare function notInArray<T>(column: SQL.Aliased<T>, values: (T | Placeholder)[] | Placeholder | SQLWrapper): SQL;
|
|
22
198
|
export declare function notInArray<TColumn extends AnyColumn>(column: TColumn, values: (GetColumnData<TColumn, 'raw'> | Placeholder)[] | Placeholder | SQLWrapper): SQL;
|
|
199
|
+
/**
|
|
200
|
+
* Test whether an expression is NULL. By the SQL standard,
|
|
201
|
+
* NULL is neither equal nor not equal to itself, so
|
|
202
|
+
* it's recommended to use `isNull` and `notIsNull` for
|
|
203
|
+
* comparisons to NULL.
|
|
204
|
+
*
|
|
205
|
+
* ## Examples
|
|
206
|
+
*
|
|
207
|
+
* ```ts
|
|
208
|
+
* // Select cars that have no discontinuedAt date.
|
|
209
|
+
* db.select(cars)
|
|
210
|
+
* .where(isNull(cars.discontinuedAt))
|
|
211
|
+
* ```
|
|
212
|
+
*
|
|
213
|
+
* @see isNotNull for the inverse of this test
|
|
214
|
+
*/
|
|
23
215
|
export declare function isNull(column: AnyColumn | Placeholder | SQLWrapper): SQL;
|
|
216
|
+
/**
|
|
217
|
+
* Test whether an expression is not NULL. By the SQL standard,
|
|
218
|
+
* NULL is neither equal nor not equal to itself, so
|
|
219
|
+
* it's recommended to use `isNull` and `notIsNull` for
|
|
220
|
+
* comparisons to NULL.
|
|
221
|
+
*
|
|
222
|
+
* ## Examples
|
|
223
|
+
*
|
|
224
|
+
* ```ts
|
|
225
|
+
* // Select cars that have been discontinued.
|
|
226
|
+
* db.select(cars)
|
|
227
|
+
* .where(isNotNull(cars.discontinuedAt))
|
|
228
|
+
* ```
|
|
229
|
+
*
|
|
230
|
+
* @see isNull for the inverse of this test
|
|
231
|
+
*/
|
|
24
232
|
export declare function isNotNull(column: AnyColumn | Placeholder | SQLWrapper): SQL;
|
|
233
|
+
/**
|
|
234
|
+
* Test whether a subquery evaluates to have any rows.
|
|
235
|
+
*
|
|
236
|
+
* ## Examples
|
|
237
|
+
*
|
|
238
|
+
* ```ts
|
|
239
|
+
* // Users whose `homeCity` column has a match in a cities
|
|
240
|
+
* // table.
|
|
241
|
+
* db
|
|
242
|
+
* .select()
|
|
243
|
+
* .from(users)
|
|
244
|
+
* .where(
|
|
245
|
+
* exists(db.select()
|
|
246
|
+
* .from(cities)
|
|
247
|
+
* .where(eq(users.homeCity, cities.id))),
|
|
248
|
+
* );
|
|
249
|
+
* ```
|
|
250
|
+
*
|
|
251
|
+
* @see notExists for the inverse of this test
|
|
252
|
+
*/
|
|
25
253
|
export declare function exists(subquery: SQLWrapper): SQL;
|
|
254
|
+
/**
|
|
255
|
+
* Test whether a subquery doesn't include any result
|
|
256
|
+
* rows.
|
|
257
|
+
*
|
|
258
|
+
* ## Examples
|
|
259
|
+
*
|
|
260
|
+
* ```ts
|
|
261
|
+
* // Users whose `homeCity` column doesn't match
|
|
262
|
+
* // a row in the cities table.
|
|
263
|
+
* db
|
|
264
|
+
* .select()
|
|
265
|
+
* .from(users)
|
|
266
|
+
* .where(
|
|
267
|
+
* notExists(db.select()
|
|
268
|
+
* .from(cities)
|
|
269
|
+
* .where(eq(users.homeCity, cities.id))),
|
|
270
|
+
* );
|
|
271
|
+
* ```
|
|
272
|
+
*
|
|
273
|
+
* @see exists for the inverse of this test
|
|
274
|
+
*/
|
|
26
275
|
export declare function notExists(subquery: SQLWrapper): SQL;
|
|
276
|
+
/**
|
|
277
|
+
* Test whether an expression is between two values. This
|
|
278
|
+
* is an easier way to express range tests, which would be
|
|
279
|
+
* expressed mathematically as `x <= a <= y` but in SQL
|
|
280
|
+
* would have to be like `a >= x AND a <= y`.
|
|
281
|
+
*
|
|
282
|
+
* Between is inclusive of the endpoints: if `column`
|
|
283
|
+
* is equal to `min` or `max`, it will be TRUE.
|
|
284
|
+
*
|
|
285
|
+
* ## Examples
|
|
286
|
+
*
|
|
287
|
+
* ```ts
|
|
288
|
+
* // Select cars made between 1990 and 2000
|
|
289
|
+
* db.select(cars)
|
|
290
|
+
* .where(between(cars.year, 1990, 2000))
|
|
291
|
+
* ```
|
|
292
|
+
*
|
|
293
|
+
* @see notBetween for the inverse of this test
|
|
294
|
+
*/
|
|
27
295
|
export declare function between<T>(column: SQL.Aliased, min: T | Placeholder | SQLWrapper, max: T | Placeholder | SQLWrapper): SQL;
|
|
28
296
|
export declare function between<TColumn extends AnyColumn>(column: TColumn, min: GetColumnData<TColumn, 'raw'> | Placeholder | SQLWrapper, max: GetColumnData<TColumn, 'raw'> | Placeholder | SQLWrapper): SQL;
|
|
297
|
+
/**
|
|
298
|
+
* Test whether an expression is not between two values.
|
|
299
|
+
*
|
|
300
|
+
* This, like `between`, includes its endpoints, so if
|
|
301
|
+
* the `column` is equal to `min` or `max`, in this case
|
|
302
|
+
* it will evaluate to FALSE.
|
|
303
|
+
*
|
|
304
|
+
* ## Examples
|
|
305
|
+
*
|
|
306
|
+
* ```ts
|
|
307
|
+
* // Exclude cars made in the 1970s
|
|
308
|
+
* db.select(cars)
|
|
309
|
+
* .where(notBetween(cars.year, 1970, 1979))
|
|
310
|
+
* ```
|
|
311
|
+
*
|
|
312
|
+
* @see between for the inverse of this test
|
|
313
|
+
*/
|
|
29
314
|
export declare function notBetween<T>(column: SQL.Aliased, min: T | Placeholder | SQLWrapper, max: T | Placeholder | SQLWrapper): SQL;
|
|
30
315
|
export declare function notBetween<TColumn extends AnyColumn>(column: TColumn, min: GetColumnData<TColumn, 'raw'> | Placeholder | SQLWrapper, max: GetColumnData<TColumn, 'raw'> | Placeholder | SQLWrapper): SQL;
|
|
316
|
+
/**
|
|
317
|
+
* Compare a column to a pattern, which can include `%` and `_`
|
|
318
|
+
* characters to match multiple variations. Including `%`
|
|
319
|
+
* in the pattern matches zero or more characters, and including
|
|
320
|
+
* `_` will match a single character.
|
|
321
|
+
*
|
|
322
|
+
* ## Examples
|
|
323
|
+
*
|
|
324
|
+
* ```ts
|
|
325
|
+
* // Select all cars with 'Turbo' in their names.
|
|
326
|
+
* db.select(cars)
|
|
327
|
+
* .where(like(cars.name, '%Turbo%'))
|
|
328
|
+
* ```
|
|
329
|
+
*
|
|
330
|
+
* @see ilike for a case-insensitive version of this condition
|
|
331
|
+
*/
|
|
31
332
|
export declare function like(column: AnyColumn, value: string | Placeholder | SQLWrapper): SQL;
|
|
333
|
+
/**
|
|
334
|
+
* The inverse of like - this tests that a given column
|
|
335
|
+
* does not match a pattern, which can include `%` and `_`
|
|
336
|
+
* characters to match multiple variations. Including `%`
|
|
337
|
+
* in the pattern matches zero or more characters, and including
|
|
338
|
+
* `_` will match a single character.
|
|
339
|
+
*
|
|
340
|
+
* ## Examples
|
|
341
|
+
*
|
|
342
|
+
* ```ts
|
|
343
|
+
* // Select all cars that don't have "ROver" in their name.
|
|
344
|
+
* db.select(cars)
|
|
345
|
+
* .where(notLike(cars.name, '%Rover%'))
|
|
346
|
+
* ```
|
|
347
|
+
*
|
|
348
|
+
* @see like for the inverse condition
|
|
349
|
+
* @see notIlike for a case-insensitive version of this condition
|
|
350
|
+
*/
|
|
32
351
|
export declare function notLike(column: AnyColumn, value: string | Placeholder | SQLWrapper): SQL;
|
|
352
|
+
/**
|
|
353
|
+
* Case-insensitively compare a column to a pattern,
|
|
354
|
+
* which can include `%` and `_`
|
|
355
|
+
* characters to match multiple variations. Including `%`
|
|
356
|
+
* in the pattern matches zero or more characters, and including
|
|
357
|
+
* `_` will match a single character.
|
|
358
|
+
*
|
|
359
|
+
* Unlike like, this performs a case-insensitive comparison.
|
|
360
|
+
*
|
|
361
|
+
* ## Examples
|
|
362
|
+
*
|
|
363
|
+
* ```ts
|
|
364
|
+
* // Select all cars with 'Turbo' in their names.
|
|
365
|
+
* db.select(cars)
|
|
366
|
+
* .where(ilike(cars.name, '%Turbo%'))
|
|
367
|
+
* ```
|
|
368
|
+
*
|
|
369
|
+
* @see like for a case-sensitive version of this condition
|
|
370
|
+
*/
|
|
33
371
|
export declare function ilike(column: AnyColumn, value: string | Placeholder | SQLWrapper): SQL;
|
|
372
|
+
/**
|
|
373
|
+
* The inverse of ilike - this case-insensitively tests that a given column
|
|
374
|
+
* does not match a pattern, which can include `%` and `_`
|
|
375
|
+
* characters to match multiple variations. Including `%`
|
|
376
|
+
* in the pattern matches zero or more characters, and including
|
|
377
|
+
* `_` will match a single character.
|
|
378
|
+
*
|
|
379
|
+
* ## Examples
|
|
380
|
+
*
|
|
381
|
+
* ```ts
|
|
382
|
+
* // Select all cars that don't have "Rover" in their name.
|
|
383
|
+
* db.select(cars)
|
|
384
|
+
* .where(notLike(cars.name, '%Rover%'))
|
|
385
|
+
* ```
|
|
386
|
+
*
|
|
387
|
+
* @see ilike for the inverse condition
|
|
388
|
+
* @see notLike for a case-sensitive version of this condition
|
|
389
|
+
*/
|
|
34
390
|
export declare function notIlike(column: AnyColumn, value: string | Placeholder | SQLWrapper): SQL;
|
|
35
391
|
//# sourceMappingURL=conditions.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../../../src/sql/expressions/conditions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAU,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAGtE,OAAO,EAIN,WAAW,EACX,KAAK,GAAG,EAER,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,MAAM,UAAU,CAAC;AAElB,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,GAAG,QAAQ,CAQrF;
|
|
1
|
+
{"version":3,"file":"conditions.d.ts","sourceRoot":"","sources":["../../../src/sql/expressions/conditions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAU,KAAK,aAAa,EAAE,MAAM,UAAU,CAAC;AAGtE,OAAO,EAIN,WAAW,EACX,KAAK,GAAG,EAER,KAAK,QAAQ,EACb,KAAK,UAAU,EACf,MAAM,UAAU,CAAC;AAElB,wBAAgB,WAAW,CAAC,KAAK,EAAE,OAAO,EAAE,MAAM,EAAE,SAAS,GAAG,GAAG,CAAC,OAAO,GAAG,QAAQ,CAQrF;AAGD;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,EAAE,CAAC,CAAC,EACnB,IAAI,EAAE,GAAG,CAAC,OAAO,CAAC,CAAC,CAAC,EACpB,KAAK,EAAE,CAAC,GAAG,WAAW,GAAG,UAAU,GAAG,SAAS,GAC7C,GAA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GAAG,WAAW,GAAG,UAAU,GAAG,GAAG,CAEtF;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,QAAQ,CAAC,MAAM,EAAE,SAAS,EAAE,KAAK,EAAE,MAAM,GAAG,WAAW,GAAG,UAAU,GAAG,GAAG,CAEzF"}
|
|
@@ -21,6 +21,22 @@ function ne(left, right) {
|
|
|
21
21
|
return (0, index_1.sql) `${left} <> ${bindIfParam(right, left)}`;
|
|
22
22
|
}
|
|
23
23
|
exports.ne = ne;
|
|
24
|
+
/**
|
|
25
|
+
* Combine a list of conditions with the `and` operator. Conditions
|
|
26
|
+
* that are equal `undefined` are automatically ignored.
|
|
27
|
+
*
|
|
28
|
+
* ## Examples
|
|
29
|
+
*
|
|
30
|
+
* ```ts
|
|
31
|
+
* db.select(cars)
|
|
32
|
+
* .where(
|
|
33
|
+
* and(
|
|
34
|
+
* eq(cars.make, 'Volvo'),
|
|
35
|
+
* eq(cars.year, 1950),
|
|
36
|
+
* )
|
|
37
|
+
* )
|
|
38
|
+
* ```
|
|
39
|
+
*/
|
|
24
40
|
function and(...conditions) {
|
|
25
41
|
if (conditions.length === 0) {
|
|
26
42
|
return undefined;
|
|
@@ -40,6 +56,22 @@ function and(...conditions) {
|
|
|
40
56
|
return index_1.sql.fromList(chunks);
|
|
41
57
|
}
|
|
42
58
|
exports.and = and;
|
|
59
|
+
/**
|
|
60
|
+
* Combine a list of conditions with the `or` operator. Conditions
|
|
61
|
+
* that are equal `undefined` are automatically ignored.
|
|
62
|
+
*
|
|
63
|
+
* ## Examples
|
|
64
|
+
*
|
|
65
|
+
* ```ts
|
|
66
|
+
* db.select(cars)
|
|
67
|
+
* .where(
|
|
68
|
+
* or(
|
|
69
|
+
* eq(cars.make, 'GM'),
|
|
70
|
+
* eq(cars.make, 'Ford'),
|
|
71
|
+
* )
|
|
72
|
+
* )
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
43
75
|
function or(...conditions) {
|
|
44
76
|
if (conditions.length === 0) {
|
|
45
77
|
return undefined;
|
|
@@ -59,6 +91,17 @@ function or(...conditions) {
|
|
|
59
91
|
return index_1.sql.fromList(chunks);
|
|
60
92
|
}
|
|
61
93
|
exports.or = or;
|
|
94
|
+
/**
|
|
95
|
+
* Negate the meaning of an expression using the `not` keyword.
|
|
96
|
+
*
|
|
97
|
+
* ## Examples
|
|
98
|
+
*
|
|
99
|
+
* ```ts
|
|
100
|
+
* // Select cars _not_ made by GM or Ford.
|
|
101
|
+
* db.select(cars)
|
|
102
|
+
* .where(not(inArray(cars.make, ['GM', 'Ford'])))
|
|
103
|
+
* ```
|
|
104
|
+
*/
|
|
62
105
|
function not(condition) {
|
|
63
106
|
return (0, index_1.sql) `not ${condition}`;
|
|
64
107
|
}
|
|
@@ -102,18 +145,91 @@ function notInArray(column, values) {
|
|
|
102
145
|
return (0, index_1.sql) `${column} not in ${bindIfParam(values, column)}`;
|
|
103
146
|
}
|
|
104
147
|
exports.notInArray = notInArray;
|
|
148
|
+
/**
|
|
149
|
+
* Test whether an expression is NULL. By the SQL standard,
|
|
150
|
+
* NULL is neither equal nor not equal to itself, so
|
|
151
|
+
* it's recommended to use `isNull` and `notIsNull` for
|
|
152
|
+
* comparisons to NULL.
|
|
153
|
+
*
|
|
154
|
+
* ## Examples
|
|
155
|
+
*
|
|
156
|
+
* ```ts
|
|
157
|
+
* // Select cars that have no discontinuedAt date.
|
|
158
|
+
* db.select(cars)
|
|
159
|
+
* .where(isNull(cars.discontinuedAt))
|
|
160
|
+
* ```
|
|
161
|
+
*
|
|
162
|
+
* @see isNotNull for the inverse of this test
|
|
163
|
+
*/
|
|
105
164
|
function isNull(column) {
|
|
106
165
|
return (0, index_1.sql) `${column} is null`;
|
|
107
166
|
}
|
|
108
167
|
exports.isNull = isNull;
|
|
168
|
+
/**
|
|
169
|
+
* Test whether an expression is not NULL. By the SQL standard,
|
|
170
|
+
* NULL is neither equal nor not equal to itself, so
|
|
171
|
+
* it's recommended to use `isNull` and `notIsNull` for
|
|
172
|
+
* comparisons to NULL.
|
|
173
|
+
*
|
|
174
|
+
* ## Examples
|
|
175
|
+
*
|
|
176
|
+
* ```ts
|
|
177
|
+
* // Select cars that have been discontinued.
|
|
178
|
+
* db.select(cars)
|
|
179
|
+
* .where(isNotNull(cars.discontinuedAt))
|
|
180
|
+
* ```
|
|
181
|
+
*
|
|
182
|
+
* @see isNull for the inverse of this test
|
|
183
|
+
*/
|
|
109
184
|
function isNotNull(column) {
|
|
110
185
|
return (0, index_1.sql) `${column} is not null`;
|
|
111
186
|
}
|
|
112
187
|
exports.isNotNull = isNotNull;
|
|
188
|
+
/**
|
|
189
|
+
* Test whether a subquery evaluates to have any rows.
|
|
190
|
+
*
|
|
191
|
+
* ## Examples
|
|
192
|
+
*
|
|
193
|
+
* ```ts
|
|
194
|
+
* // Users whose `homeCity` column has a match in a cities
|
|
195
|
+
* // table.
|
|
196
|
+
* db
|
|
197
|
+
* .select()
|
|
198
|
+
* .from(users)
|
|
199
|
+
* .where(
|
|
200
|
+
* exists(db.select()
|
|
201
|
+
* .from(cities)
|
|
202
|
+
* .where(eq(users.homeCity, cities.id))),
|
|
203
|
+
* );
|
|
204
|
+
* ```
|
|
205
|
+
*
|
|
206
|
+
* @see notExists for the inverse of this test
|
|
207
|
+
*/
|
|
113
208
|
function exists(subquery) {
|
|
114
209
|
return (0, index_1.sql) `exists (${subquery})`;
|
|
115
210
|
}
|
|
116
211
|
exports.exists = exists;
|
|
212
|
+
/**
|
|
213
|
+
* Test whether a subquery doesn't include any result
|
|
214
|
+
* rows.
|
|
215
|
+
*
|
|
216
|
+
* ## Examples
|
|
217
|
+
*
|
|
218
|
+
* ```ts
|
|
219
|
+
* // Users whose `homeCity` column doesn't match
|
|
220
|
+
* // a row in the cities table.
|
|
221
|
+
* db
|
|
222
|
+
* .select()
|
|
223
|
+
* .from(users)
|
|
224
|
+
* .where(
|
|
225
|
+
* notExists(db.select()
|
|
226
|
+
* .from(cities)
|
|
227
|
+
* .where(eq(users.homeCity, cities.id))),
|
|
228
|
+
* );
|
|
229
|
+
* ```
|
|
230
|
+
*
|
|
231
|
+
* @see exists for the inverse of this test
|
|
232
|
+
*/
|
|
117
233
|
function notExists(subquery) {
|
|
118
234
|
return (0, index_1.sql) `exists (${subquery})`;
|
|
119
235
|
}
|
|
@@ -126,18 +242,89 @@ function notBetween(column, min, max) {
|
|
|
126
242
|
return (0, index_1.sql) `${column} not between ${bindIfParam(min, column)} and ${bindIfParam(max, column)}`;
|
|
127
243
|
}
|
|
128
244
|
exports.notBetween = notBetween;
|
|
245
|
+
/**
|
|
246
|
+
* Compare a column to a pattern, which can include `%` and `_`
|
|
247
|
+
* characters to match multiple variations. Including `%`
|
|
248
|
+
* in the pattern matches zero or more characters, and including
|
|
249
|
+
* `_` will match a single character.
|
|
250
|
+
*
|
|
251
|
+
* ## Examples
|
|
252
|
+
*
|
|
253
|
+
* ```ts
|
|
254
|
+
* // Select all cars with 'Turbo' in their names.
|
|
255
|
+
* db.select(cars)
|
|
256
|
+
* .where(like(cars.name, '%Turbo%'))
|
|
257
|
+
* ```
|
|
258
|
+
*
|
|
259
|
+
* @see ilike for a case-insensitive version of this condition
|
|
260
|
+
*/
|
|
129
261
|
function like(column, value) {
|
|
130
262
|
return (0, index_1.sql) `${column} like ${value}`;
|
|
131
263
|
}
|
|
132
264
|
exports.like = like;
|
|
265
|
+
/**
|
|
266
|
+
* The inverse of like - this tests that a given column
|
|
267
|
+
* does not match a pattern, which can include `%` and `_`
|
|
268
|
+
* characters to match multiple variations. Including `%`
|
|
269
|
+
* in the pattern matches zero or more characters, and including
|
|
270
|
+
* `_` will match a single character.
|
|
271
|
+
*
|
|
272
|
+
* ## Examples
|
|
273
|
+
*
|
|
274
|
+
* ```ts
|
|
275
|
+
* // Select all cars that don't have "ROver" in their name.
|
|
276
|
+
* db.select(cars)
|
|
277
|
+
* .where(notLike(cars.name, '%Rover%'))
|
|
278
|
+
* ```
|
|
279
|
+
*
|
|
280
|
+
* @see like for the inverse condition
|
|
281
|
+
* @see notIlike for a case-insensitive version of this condition
|
|
282
|
+
*/
|
|
133
283
|
function notLike(column, value) {
|
|
134
284
|
return (0, index_1.sql) `${column} not like ${value}`;
|
|
135
285
|
}
|
|
136
286
|
exports.notLike = notLike;
|
|
287
|
+
/**
|
|
288
|
+
* Case-insensitively compare a column to a pattern,
|
|
289
|
+
* which can include `%` and `_`
|
|
290
|
+
* characters to match multiple variations. Including `%`
|
|
291
|
+
* in the pattern matches zero or more characters, and including
|
|
292
|
+
* `_` will match a single character.
|
|
293
|
+
*
|
|
294
|
+
* Unlike like, this performs a case-insensitive comparison.
|
|
295
|
+
*
|
|
296
|
+
* ## Examples
|
|
297
|
+
*
|
|
298
|
+
* ```ts
|
|
299
|
+
* // Select all cars with 'Turbo' in their names.
|
|
300
|
+
* db.select(cars)
|
|
301
|
+
* .where(ilike(cars.name, '%Turbo%'))
|
|
302
|
+
* ```
|
|
303
|
+
*
|
|
304
|
+
* @see like for a case-sensitive version of this condition
|
|
305
|
+
*/
|
|
137
306
|
function ilike(column, value) {
|
|
138
307
|
return (0, index_1.sql) `${column} ilike ${value}`;
|
|
139
308
|
}
|
|
140
309
|
exports.ilike = ilike;
|
|
310
|
+
/**
|
|
311
|
+
* The inverse of ilike - this case-insensitively tests that a given column
|
|
312
|
+
* does not match a pattern, which can include `%` and `_`
|
|
313
|
+
* characters to match multiple variations. Including `%`
|
|
314
|
+
* in the pattern matches zero or more characters, and including
|
|
315
|
+
* `_` will match a single character.
|
|
316
|
+
*
|
|
317
|
+
* ## Examples
|
|
318
|
+
*
|
|
319
|
+
* ```ts
|
|
320
|
+
* // Select all cars that don't have "Rover" in their name.
|
|
321
|
+
* db.select(cars)
|
|
322
|
+
* .where(notLike(cars.name, '%Rover%'))
|
|
323
|
+
* ```
|
|
324
|
+
*
|
|
325
|
+
* @see ilike for the inverse condition
|
|
326
|
+
* @see notLike for a case-sensitive version of this condition
|
|
327
|
+
*/
|
|
141
328
|
function notIlike(column, value) {
|
|
142
329
|
return (0, index_1.sql) `${column} not ilike ${value}`;
|
|
143
330
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"conditions.js","sourceRoot":"","sources":["../../../src/sql/expressions/conditions.ts"],"names":[],"mappings":";;;AAAA,qCAAsE;AACtE,mCAAgC;AAChC,iCAA8B;AAC9B,oCASkB;AAElB,SAAgB,WAAW,CAAC,KAAc,EAAE,MAA+B;IAC1E,IACC,IAAA,4BAAoB,EAAC,MAAM,CAAC,IAAI,CAAC,IAAA,oBAAY,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,YAAY,aAAK,CAAC,IAAI,CAAC,CAAC,KAAK,YAAY,mBAAW,CAAC;WACjH,CAAC,CAAC,KAAK,YAAY,eAAM,CAAC,IAAI,CAAC,CAAC,KAAK,YAAY,aAAK,CAAC,IAAI,CAAC,CAAC,KAAK,YAAY,WAAI,CAAC,EACrF;QACD,OAAO,IAAI,aAAK,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC;KAChC;IACD,OAAO,KAAiB,CAAC;AAC1B,CAAC;AARD,kCAQC;
|
|
1
|
+
{"version":3,"file":"conditions.js","sourceRoot":"","sources":["../../../src/sql/expressions/conditions.ts"],"names":[],"mappings":";;;AAAA,qCAAsE;AACtE,mCAAgC;AAChC,iCAA8B;AAC9B,oCASkB;AAElB,SAAgB,WAAW,CAAC,KAAc,EAAE,MAA+B;IAC1E,IACC,IAAA,4BAAoB,EAAC,MAAM,CAAC,IAAI,CAAC,IAAA,oBAAY,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,YAAY,aAAK,CAAC,IAAI,CAAC,CAAC,KAAK,YAAY,mBAAW,CAAC;WACjH,CAAC,CAAC,KAAK,YAAY,eAAM,CAAC,IAAI,CAAC,CAAC,KAAK,YAAY,aAAK,CAAC,IAAI,CAAC,CAAC,KAAK,YAAY,WAAI,CAAC,EACrF;QACD,OAAO,IAAI,aAAK,CAAC,KAAK,EAAE,MAAM,CAAC,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AACrC,CAAC;AAFD,oBAEC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,OAAO,CAAC,MAAiB,EAAE,KAAwC;IAClF,OAAO,IAAA,WAAG,EAAA,GAAG,MAAM,aAAa,KAAK,EAAE,CAAC;AACzC,CAAC;AAFD,0BAEC;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,SAAgB,KAAK,CAAC,MAAiB,EAAE,KAAwC;IAChF,OAAO,IAAA,WAAG,EAAA,GAAG,MAAM,UAAU,KAAK,EAAE,CAAC;AACtC,CAAC;AAFD,sBAEC;AAED;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,QAAQ,CAAC,MAAiB,EAAE,KAAwC;IACnF,OAAO,IAAA,WAAG,EAAA,GAAG,MAAM,cAAc,KAAK,EAAE,CAAC;AAC1C,CAAC;AAFD,4BAEC"}
|
|
@@ -1,5 +1,39 @@
|
|
|
1
1
|
import type { AnyColumn } from '../../column';
|
|
2
2
|
import type { SQL, SQLWrapper } from '..';
|
|
3
|
+
/**
|
|
4
|
+
* Used in sorting, this specifies that the given
|
|
5
|
+
* column or expression should be sorted in ascending
|
|
6
|
+
* order. By the SQL standard, ascending order is the
|
|
7
|
+
* default, so it is not usually necessary to specify
|
|
8
|
+
* ascending sort order.
|
|
9
|
+
*
|
|
10
|
+
* ## Examples
|
|
11
|
+
*
|
|
12
|
+
* ```ts
|
|
13
|
+
* // Return cars, starting with the oldest models
|
|
14
|
+
* // and going in ascending order to the newest.
|
|
15
|
+
* db.select(cars)
|
|
16
|
+
* .orderBy(asc(cars.year));
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @see desc to sort in descending order
|
|
20
|
+
*/
|
|
3
21
|
export declare function asc(column: AnyColumn | SQLWrapper): SQL;
|
|
22
|
+
/**
|
|
23
|
+
* Used in sorting, this specifies that the given
|
|
24
|
+
* column or expression should be sorted in descending
|
|
25
|
+
* order.
|
|
26
|
+
*
|
|
27
|
+
* ## Examples
|
|
28
|
+
*
|
|
29
|
+
* ```ts
|
|
30
|
+
* // Select users, with the most recently created
|
|
31
|
+
* // records coming first.
|
|
32
|
+
* db.select(users)
|
|
33
|
+
* .orderBy(desc(users.createdAt));
|
|
34
|
+
* ```
|
|
35
|
+
*
|
|
36
|
+
* @see asc to sort in ascending order
|
|
37
|
+
*/
|
|
4
38
|
export declare function desc(column: AnyColumn | SQLWrapper): SQL;
|
|
5
39
|
//# sourceMappingURL=select.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/sql/expressions/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAG1C,wBAAgB,GAAG,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,GAAG,CAEvD;
|
|
1
|
+
{"version":3,"file":"select.d.ts","sourceRoot":"","sources":["../../../src/sql/expressions/select.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,KAAK,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAG1C;;;;;;;;;;;;;;;;;GAiBG;AACH,wBAAgB,GAAG,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,GAAG,CAEvD;AAGD;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,IAAI,CAAC,MAAM,EAAE,SAAS,GAAG,UAAU,GAAG,GAAG,CAExD"}
|
|
@@ -2,10 +2,44 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.desc = exports.asc = void 0;
|
|
4
4
|
const __1 = require("..");
|
|
5
|
+
/**
|
|
6
|
+
* Used in sorting, this specifies that the given
|
|
7
|
+
* column or expression should be sorted in ascending
|
|
8
|
+
* order. By the SQL standard, ascending order is the
|
|
9
|
+
* default, so it is not usually necessary to specify
|
|
10
|
+
* ascending sort order.
|
|
11
|
+
*
|
|
12
|
+
* ## Examples
|
|
13
|
+
*
|
|
14
|
+
* ```ts
|
|
15
|
+
* // Return cars, starting with the oldest models
|
|
16
|
+
* // and going in ascending order to the newest.
|
|
17
|
+
* db.select(cars)
|
|
18
|
+
* .orderBy(asc(cars.year));
|
|
19
|
+
* ```
|
|
20
|
+
*
|
|
21
|
+
* @see desc to sort in descending order
|
|
22
|
+
*/
|
|
5
23
|
function asc(column) {
|
|
6
24
|
return (0, __1.sql) `${column} asc`;
|
|
7
25
|
}
|
|
8
26
|
exports.asc = asc;
|
|
27
|
+
/**
|
|
28
|
+
* Used in sorting, this specifies that the given
|
|
29
|
+
* column or expression should be sorted in descending
|
|
30
|
+
* order.
|
|
31
|
+
*
|
|
32
|
+
* ## Examples
|
|
33
|
+
*
|
|
34
|
+
* ```ts
|
|
35
|
+
* // Select users, with the most recently created
|
|
36
|
+
* // records coming first.
|
|
37
|
+
* db.select(users)
|
|
38
|
+
* .orderBy(desc(users.createdAt));
|
|
39
|
+
* ```
|
|
40
|
+
*
|
|
41
|
+
* @see asc to sort in ascending order
|
|
42
|
+
*/
|
|
9
43
|
function desc(column) {
|
|
10
44
|
return (0, __1.sql) `${column} desc`;
|
|
11
45
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/sql/expressions/select.ts"],"names":[],"mappings":";;;AAEA,0BAAyB;AAEzB,SAAgB,GAAG,CAAC,MAA8B;IACjD,OAAO,IAAA,OAAG,EAAA,GAAG,MAAM,MAAM,CAAC;AAC3B,CAAC;AAFD,kBAEC;
|
|
1
|
+
{"version":3,"file":"select.js","sourceRoot":"","sources":["../../../src/sql/expressions/select.ts"],"names":[],"mappings":";;;AAEA,0BAAyB;AAEzB;;;;;;;;;;;;;;;;;GAiBG;AACH,SAAgB,GAAG,CAAC,MAA8B;IACjD,OAAO,IAAA,OAAG,EAAA,GAAG,MAAM,MAAM,CAAC;AAC3B,CAAC;AAFD,kBAEC;AAGD;;;;;;;;;;;;;;;GAeG;AACH,SAAgB,IAAI,CAAC,MAA8B;IAClD,OAAO,IAAA,OAAG,EAAA,GAAG,MAAM,OAAO,CAAC;AAC5B,CAAC;AAFD,oBAEC"}
|
|
@@ -77,14 +77,14 @@ class SQLiteInsert {
|
|
|
77
77
|
}
|
|
78
78
|
else {
|
|
79
79
|
const whereSql = config.where ? (0, sql_1.sql) ` where ${config.where}` : (0, sql_1.sql) ``;
|
|
80
|
-
this.config.onConflict = (0, sql_1.sql)
|
|
80
|
+
this.config.onConflict = (0, sql_1.sql) `(${config.target})${whereSql} do nothing`;
|
|
81
81
|
}
|
|
82
82
|
return this;
|
|
83
83
|
}
|
|
84
84
|
onConflictDoUpdate(config) {
|
|
85
85
|
const whereSql = config.where ? (0, sql_1.sql) ` where ${config.where}` : (0, sql_1.sql) ``;
|
|
86
86
|
const setSql = this.dialect.buildUpdateSet(this.config.table, (0, utils_1.mapUpdateSet)(this.config.table, config.set));
|
|
87
|
-
this.config.onConflict = (0, sql_1.sql)
|
|
87
|
+
this.config.onConflict = (0, sql_1.sql) `(${config.target})${whereSql} do update set ${setSql}`;
|
|
88
88
|
return this;
|
|
89
89
|
}
|
|
90
90
|
/** @internal */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"insert.js","sourceRoot":"","sources":["../../../src/sqlite-core/query-builders/insert.ts"],"names":[],"mappings":";;;;;;;;;;;;;;AAEA,+BAAwC;AAKxC,+CAAkD;AAClD,mCAAiD;AAEjD,mCAA4D;AAiB5D,MAAa,mBAAmB;IAK/B,YACW,KAAa,EACb,OAAsB,EACtB,OAAsB;QAFtB,UAAK,GAAL,KAAK,CAAQ;QACb,YAAO,GAAP,OAAO,CAAe;QACtB,YAAO,GAAP,OAAO,CAAe;IAC9B,CAAC;IAQJ,MAAM,CACL,GAAG,MAAiG;QAEpG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