knex 2.0.0 → 2.3.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.
- package/CHANGELOG.md +53 -0
- package/CONTRIBUTING.md +10 -0
- package/lib/dialects/cockroachdb/crdb-columncompiler.js +14 -0
- package/lib/dialects/cockroachdb/index.js +5 -0
- package/lib/dialects/index.js +34 -0
- package/lib/dialects/mssql/index.js +20 -14
- package/lib/dialects/mssql/schema/mssql-compiler.js +9 -2
- package/lib/dialects/mysql/query/mysql-querycompiler.js +1 -1
- package/lib/dialects/mysql/schema/mysql-compiler.js +2 -2
- package/lib/dialects/oracledb/index.js +2 -1
- package/lib/dialects/postgres/schema/pg-columncompiler.js +8 -1
- package/lib/dialects/postgres/schema/pg-compiler.js +2 -2
- package/lib/dialects/postgres/schema/pg-tablecompiler.js +33 -6
- package/lib/dialects/sqlite3/index.js +20 -7
- package/lib/dialects/sqlite3/query/sqlite-querycompiler.js +18 -1
- package/lib/execution/runner.js +2 -9
- package/lib/formatter/wrappingFormatter.js +1 -2
- package/lib/knex-builder/Knex.js +28 -0
- package/lib/knex-builder/internal/config-resolver.js +2 -3
- package/lib/knex-builder/internal/parse-connection.js +4 -2
- package/lib/migrations/migrate/MigrationGenerator.js +1 -1
- package/lib/migrations/migrate/stub/js-schema.stub +22 -0
- package/lib/migrations/migrate/stub/ts-schema.stub +21 -0
- package/lib/schema/builder.js +12 -0
- package/lib/schema/columnbuilder.js +12 -0
- package/lib/schema/columncompiler.js +4 -2
- package/lib/schema/tablebuilder.js +12 -0
- package/lib/schema/viewbuilder.js +12 -0
- package/package.json +33 -23
- package/scripts/clean.js +29 -0
- package/scripts/update_gitignore_for_tsc_output.js +85 -0
- package/types/index.d.ts +849 -396
package/types/index.d.ts
CHANGED
|
@@ -13,8 +13,8 @@ import ResultTypes = require('./result');
|
|
|
13
13
|
|
|
14
14
|
import { Tables } from './tables';
|
|
15
15
|
|
|
16
|
-
import { ConnectionOptions } from
|
|
17
|
-
import { Stream } from
|
|
16
|
+
import { ConnectionOptions } from 'tls';
|
|
17
|
+
import { Stream } from 'stream';
|
|
18
18
|
|
|
19
19
|
// # Generic type-level utilities
|
|
20
20
|
|
|
@@ -30,9 +30,10 @@ type StrKey<T> = string & keyof T;
|
|
|
30
30
|
|
|
31
31
|
// If T is unknown then convert to any, else retain original
|
|
32
32
|
type UnknownToAny<T> = unknown extends T ? any : T;
|
|
33
|
-
type CurlyCurlyToAny<T> = T extends unknown
|
|
34
|
-
(<U>() => U extends T ? 0 : 1) extends
|
|
35
|
-
|
|
33
|
+
type CurlyCurlyToAny<T> = T extends unknown // distribute
|
|
34
|
+
? (<U>() => U extends T ? 0 : 1) extends <U>() => U extends {} ? 0 : 1
|
|
35
|
+
? any
|
|
36
|
+
: T
|
|
36
37
|
: never;
|
|
37
38
|
type UnknownOrCurlyCurlyToAny<T> = [UnknownToAny<T> | CurlyCurlyToAny<T>][0];
|
|
38
39
|
type AnyToUnknown<T> = unknown extends T ? unknown : T;
|
|
@@ -42,8 +43,8 @@ type AnyOrUnknownToOther<T1, T2> = unknown extends T1 ? T2 : T1;
|
|
|
42
43
|
// This is primarily to keep the signatures more intuitive.
|
|
43
44
|
type AugmentParams<TTarget, TParams> = TParams extends {}
|
|
44
45
|
? keyof TParams extends never
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
? TTarget
|
|
47
|
+
: {} & TTarget & TParams
|
|
47
48
|
: TTarget;
|
|
48
49
|
|
|
49
50
|
// Check if provided keys (expressed as a single or union type) are members of TBase
|
|
@@ -52,9 +53,9 @@ type AreKeysOf<TBase, TKeys> = Boxed<TKeys> extends Boxed<keyof TBase>
|
|
|
52
53
|
: false;
|
|
53
54
|
|
|
54
55
|
// https://stackoverflow.com/a/50375286/476712
|
|
55
|
-
type UnionToIntersection<U> = (U extends any
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (
|
|
57
|
+
k: infer I
|
|
58
|
+
) => void
|
|
58
59
|
? I
|
|
59
60
|
: never;
|
|
60
61
|
|
|
@@ -89,8 +90,8 @@ type PartialOrAny<TBase, TKeys> = Boxed<TKeys> extends Boxed<never>
|
|
|
89
90
|
// to facilitates type-safe aliasing for object syntax
|
|
90
91
|
type MappedAliasType<TBase, TAliasMapping> = {} & {
|
|
91
92
|
[K in keyof TAliasMapping]: TAliasMapping[K] extends keyof TBase
|
|
92
|
-
|
|
93
|
-
|
|
93
|
+
? TBase[TAliasMapping[K]]
|
|
94
|
+
: any;
|
|
94
95
|
};
|
|
95
96
|
|
|
96
97
|
// Container type for situations when we want a partial/intersection eventually
|
|
@@ -117,17 +118,17 @@ type DeferredKeySelection<
|
|
|
117
118
|
TIntersectProps extends {} = {},
|
|
118
119
|
// Extra props which will be unioned with the result
|
|
119
120
|
TUnionProps = never
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
121
|
+
> = {
|
|
122
|
+
// These properties are not actually used, but exist simply because
|
|
123
|
+
// typescript doesn't end up happy when type parameters are unused
|
|
124
|
+
_base: TBase;
|
|
125
|
+
_hasSelection: THasSelect;
|
|
126
|
+
_keys: TKeys;
|
|
127
|
+
_aliases: TAliasMapping;
|
|
128
|
+
_single: TSingle;
|
|
129
|
+
_intersectProps: TIntersectProps;
|
|
130
|
+
_unionProps: TUnionProps;
|
|
131
|
+
};
|
|
131
132
|
|
|
132
133
|
// An companion namespace for DeferredKeySelection which provides type operators
|
|
133
134
|
// to build up participants of intersection/partial over multiple invocations
|
|
@@ -149,7 +150,15 @@ declare namespace DeferredKeySelection {
|
|
|
149
150
|
infer TIntersectProps,
|
|
150
151
|
infer TUnionProps
|
|
151
152
|
>
|
|
152
|
-
? DeferredKeySelection<
|
|
153
|
+
? DeferredKeySelection<
|
|
154
|
+
TBase,
|
|
155
|
+
TKeys,
|
|
156
|
+
THasSelect,
|
|
157
|
+
TAliasMapping,
|
|
158
|
+
TSingle,
|
|
159
|
+
TIntersectProps,
|
|
160
|
+
TUnionProps
|
|
161
|
+
>
|
|
153
162
|
: DeferredKeySelection<TBase, never>;
|
|
154
163
|
|
|
155
164
|
// If TSelection is already a deferred selection, then replace the base with TBase
|
|
@@ -158,47 +167,68 @@ declare namespace DeferredKeySelection {
|
|
|
158
167
|
//
|
|
159
168
|
// For practical reasons applicable to current context, we always return arrays of
|
|
160
169
|
// deferred selections. So, this particular operator may not be useful in generic contexts.
|
|
161
|
-
type ReplaceBase<TSelection, TBase> =
|
|
162
|
-
TSelection
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
170
|
+
type ReplaceBase<TSelection, TBase> =
|
|
171
|
+
UnwrapArrayMember<TSelection> extends DeferredKeySelection.Any
|
|
172
|
+
? ArrayIfAlready<
|
|
173
|
+
TSelection,
|
|
174
|
+
DeferredKeySelection.SetBase<UnwrapArrayMember<TSelection>, TBase>
|
|
175
|
+
>
|
|
176
|
+
: unknown extends UnwrapArrayMember<TSelection>
|
|
177
|
+
? ArrayIfAlready<TSelection, DeferredKeySelection.SetBase<unknown, TBase>>
|
|
178
|
+
: TSelection;
|
|
168
179
|
|
|
169
180
|
// Type operators to substitute individual type parameters:
|
|
170
181
|
|
|
171
182
|
type SetSingle<
|
|
172
183
|
TSelection,
|
|
173
184
|
TSingle extends boolean
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
? DeferredKeySelection<
|
|
185
|
+
> = TSelection extends DeferredKeySelection<
|
|
186
|
+
infer TBase,
|
|
187
|
+
infer TKeys,
|
|
188
|
+
infer THasSelect,
|
|
189
|
+
infer TAliasMapping,
|
|
190
|
+
any,
|
|
191
|
+
infer TIntersectProps,
|
|
192
|
+
infer TUnionProps
|
|
193
|
+
>
|
|
194
|
+
? DeferredKeySelection<
|
|
195
|
+
TBase,
|
|
196
|
+
TKeys,
|
|
197
|
+
THasSelect,
|
|
198
|
+
TAliasMapping,
|
|
199
|
+
TSingle,
|
|
200
|
+
TIntersectProps,
|
|
201
|
+
TUnionProps
|
|
202
|
+
>
|
|
184
203
|
: never;
|
|
185
204
|
|
|
186
205
|
type AddKey<
|
|
187
206
|
TSelection,
|
|
188
207
|
TKey extends string
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
? DeferredKeySelection<
|
|
208
|
+
> = TSelection extends DeferredKeySelection<
|
|
209
|
+
infer TBase,
|
|
210
|
+
infer TKeys,
|
|
211
|
+
any,
|
|
212
|
+
infer TAliasMapping,
|
|
213
|
+
infer TSingle,
|
|
214
|
+
infer TIntersectProps,
|
|
215
|
+
infer TUnionProps
|
|
216
|
+
>
|
|
217
|
+
? DeferredKeySelection<
|
|
218
|
+
TBase,
|
|
219
|
+
TKeys | TKey,
|
|
220
|
+
true,
|
|
221
|
+
TAliasMapping,
|
|
222
|
+
TSingle,
|
|
223
|
+
TIntersectProps,
|
|
224
|
+
TUnionProps
|
|
225
|
+
>
|
|
199
226
|
: DeferredKeySelection<unknown, TKey, true>;
|
|
200
227
|
|
|
201
|
-
type AddAliases<
|
|
228
|
+
type AddAliases<
|
|
229
|
+
TSelection,
|
|
230
|
+
T extends {}
|
|
231
|
+
> = TSelection extends DeferredKeySelection<
|
|
202
232
|
infer TBase,
|
|
203
233
|
infer TKeys,
|
|
204
234
|
infer THasSelect,
|
|
@@ -207,7 +237,15 @@ declare namespace DeferredKeySelection {
|
|
|
207
237
|
infer TIntersectProps,
|
|
208
238
|
infer TUnionProps
|
|
209
239
|
>
|
|
210
|
-
? DeferredKeySelection<
|
|
240
|
+
? DeferredKeySelection<
|
|
241
|
+
TBase,
|
|
242
|
+
TKeys,
|
|
243
|
+
THasSelect,
|
|
244
|
+
TAliasMapping & T,
|
|
245
|
+
TSingle,
|
|
246
|
+
TIntersectProps,
|
|
247
|
+
TUnionProps
|
|
248
|
+
>
|
|
211
249
|
: DeferredKeySelection<unknown, never, false, T>;
|
|
212
250
|
|
|
213
251
|
type AddUnionMember<TSelection, T> = TSelection extends DeferredKeySelection<
|
|
@@ -219,15 +257,25 @@ declare namespace DeferredKeySelection {
|
|
|
219
257
|
infer TIntersectProps,
|
|
220
258
|
infer TUnionProps
|
|
221
259
|
>
|
|
222
|
-
? DeferredKeySelection<
|
|
260
|
+
? DeferredKeySelection<
|
|
261
|
+
TBase,
|
|
262
|
+
TKeys,
|
|
263
|
+
THasSelect,
|
|
264
|
+
TAliasMapping,
|
|
265
|
+
TSingle,
|
|
266
|
+
TIntersectProps,
|
|
267
|
+
TUnionProps | T
|
|
268
|
+
>
|
|
223
269
|
: DeferredKeySelection<TSelection, never, false, {}, false, {}, T>;
|
|
224
270
|
|
|
225
271
|
// Convenience utility to set base, keys and aliases in a single type
|
|
226
272
|
// application
|
|
227
|
-
type Augment<
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
273
|
+
type Augment<
|
|
274
|
+
T,
|
|
275
|
+
TBase,
|
|
276
|
+
TKey extends string,
|
|
277
|
+
TAliasMapping extends {} = {}
|
|
278
|
+
> = AddAliases<AddKey<SetBase<T, TBase>, TKey>, TAliasMapping>;
|
|
231
279
|
|
|
232
280
|
// Core resolution logic -- Refer to docs for DeferredKeySelection for specifics
|
|
233
281
|
type ResolveOne<TSelection> = TSelection extends DeferredKeySelection<
|
|
@@ -240,27 +288,30 @@ declare namespace DeferredKeySelection {
|
|
|
240
288
|
infer TUnionProps
|
|
241
289
|
>
|
|
242
290
|
? UnknownOrCurlyCurlyToAny<
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
291
|
+
// ^ We convert final result to any if it is unknown for backward compatibility.
|
|
292
|
+
// Historically knex typings have been liberal with returning any and changing
|
|
293
|
+
// default return type to unknown would be a major breaking change for users.
|
|
294
|
+
//
|
|
295
|
+
// So we compromise on type safety here and return any.
|
|
296
|
+
| AugmentParams<
|
|
297
|
+
AnyToUnknown<TBase> extends {}
|
|
298
|
+
? // ^ Conversion of any -> unknown is needed here to prevent distribution
|
|
299
|
+
// of any over the conditional
|
|
300
|
+
TSingle extends true
|
|
301
|
+
? TKeys extends keyof TBase
|
|
302
|
+
? TBase[TKeys]
|
|
303
|
+
: any
|
|
304
|
+
: AugmentParams<
|
|
305
|
+
true extends THasSelect
|
|
306
|
+
? PartialOrAny<TBase, TKeys>
|
|
307
|
+
: TBase,
|
|
308
|
+
MappedAliasType<TBase, TAliasMapping>
|
|
309
|
+
>
|
|
310
|
+
: unknown,
|
|
311
|
+
TIntersectProps
|
|
312
|
+
>
|
|
313
|
+
| TUnionProps
|
|
314
|
+
>
|
|
264
315
|
: TSelection;
|
|
265
316
|
|
|
266
317
|
type Resolve<TSelection> = TSelection extends DeferredKeySelection.Any
|
|
@@ -272,7 +323,10 @@ declare namespace DeferredKeySelection {
|
|
|
272
323
|
: UnknownOrCurlyCurlyToAny<Knex.ResolveTableType<TSelection>>;
|
|
273
324
|
}
|
|
274
325
|
|
|
275
|
-
type AggregationQueryResult<
|
|
326
|
+
type AggregationQueryResult<
|
|
327
|
+
TResult,
|
|
328
|
+
TIntersectProps2 extends {}
|
|
329
|
+
> = ArrayIfAlready<
|
|
276
330
|
TResult,
|
|
277
331
|
UnwrapArrayMember<TResult> extends DeferredKeySelection<
|
|
278
332
|
infer TBase,
|
|
@@ -283,10 +337,18 @@ type AggregationQueryResult<TResult, TIntersectProps2 extends {}> = ArrayIfAlrea
|
|
|
283
337
|
infer TIntersectProps,
|
|
284
338
|
infer TUnionProps
|
|
285
339
|
>
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
340
|
+
? true extends THasSelect
|
|
341
|
+
? DeferredKeySelection<
|
|
342
|
+
TBase,
|
|
343
|
+
TKeys,
|
|
344
|
+
THasSelect,
|
|
345
|
+
TAliasMapping,
|
|
346
|
+
TSingle,
|
|
347
|
+
TIntersectProps & TIntersectProps2,
|
|
348
|
+
TUnionProps
|
|
349
|
+
>
|
|
350
|
+
: DeferredKeySelection<{}, never, true, {}, false, TIntersectProps2>
|
|
351
|
+
: TIntersectProps2
|
|
290
352
|
>;
|
|
291
353
|
|
|
292
354
|
// If we have more categories of deferred selection in future,
|
|
@@ -298,7 +360,7 @@ type ResolveResult<S> = DeferredKeySelection.Resolve<S>;
|
|
|
298
360
|
type Callback = Function;
|
|
299
361
|
type Client = Function;
|
|
300
362
|
|
|
301
|
-
type Dict<T = any> = { [k: string]: T
|
|
363
|
+
type Dict<T = any> = { [k: string]: T };
|
|
302
364
|
|
|
303
365
|
type SafePick<T, K extends keyof T> = T extends {} ? Pick<T, K> : any;
|
|
304
366
|
|
|
@@ -313,12 +375,19 @@ interface DMLOptions {
|
|
|
313
375
|
}
|
|
314
376
|
|
|
315
377
|
export interface Knex<TRecord extends {} = any, TResult = any[]>
|
|
316
|
-
extends Knex.QueryInterface<TRecord, TResult>,
|
|
378
|
+
extends Knex.QueryInterface<TRecord, TResult>,
|
|
379
|
+
events.EventEmitter {
|
|
317
380
|
<TTable extends Knex.TableNames>(
|
|
318
381
|
tableName: TTable,
|
|
319
382
|
options?: TableOptions
|
|
320
|
-
): Knex.QueryBuilder<
|
|
321
|
-
|
|
383
|
+
): Knex.QueryBuilder<
|
|
384
|
+
Knex.TableType<TTable>,
|
|
385
|
+
DeferredKeySelection<Knex.ResolveTableType<Knex.TableType<TTable>>, never>[]
|
|
386
|
+
>;
|
|
387
|
+
<
|
|
388
|
+
TRecord2 extends {} = TRecord,
|
|
389
|
+
TResult2 = DeferredKeySelection<TRecord2, never>[]
|
|
390
|
+
>(
|
|
322
391
|
tableName?: Knex.TableDescriptor | Knex.AliasDict,
|
|
323
392
|
options?: TableOptions
|
|
324
393
|
): Knex.QueryBuilder<TRecord2, TResult2>;
|
|
@@ -330,9 +399,7 @@ export interface Knex<TRecord extends {} = any, TResult = any[]>
|
|
|
330
399
|
transactionProvider(
|
|
331
400
|
config?: Knex.TransactionConfig
|
|
332
401
|
): Knex.TransactionProvider;
|
|
333
|
-
transaction(
|
|
334
|
-
config?: Knex.TransactionConfig
|
|
335
|
-
): Promise<Knex.Transaction>;
|
|
402
|
+
transaction(config?: Knex.TransactionConfig): Promise<Knex.Transaction>;
|
|
336
403
|
transaction(
|
|
337
404
|
transactionScope?: null,
|
|
338
405
|
config?: Knex.TransactionConfig
|
|
@@ -350,14 +417,14 @@ export interface Knex<TRecord extends {} = any, TResult = any[]>
|
|
|
350
417
|
data: TRecord2 extends Knex.CompositeTableType<unknown>
|
|
351
418
|
? ReadonlyArray<Knex.ResolveTableType<TRecord2, 'insert'>>
|
|
352
419
|
: ReadonlyArray<Knex.DbRecordArr<TRecord2>>,
|
|
353
|
-
chunkSize?: number
|
|
420
|
+
chunkSize?: number
|
|
354
421
|
): Knex.BatchInsertBuilder<TRecord2, TResult2>;
|
|
355
422
|
|
|
356
423
|
schema: Knex.SchemaBuilder;
|
|
357
|
-
queryBuilder<
|
|
358
|
-
TRecord2,
|
|
359
|
-
TResult2
|
|
360
|
-
>;
|
|
424
|
+
queryBuilder<
|
|
425
|
+
TRecord2 extends {} = TRecord,
|
|
426
|
+
TResult2 = TResult
|
|
427
|
+
>(): Knex.QueryBuilder<TRecord2, TResult2>;
|
|
361
428
|
|
|
362
429
|
client: any;
|
|
363
430
|
migrate: Knex.Migrator;
|
|
@@ -377,10 +444,40 @@ export declare namespace knex {
|
|
|
377
444
|
class QueryBuilder {
|
|
378
445
|
static extend(
|
|
379
446
|
methodName: string,
|
|
380
|
-
fn: <TRecord extends {} = any, TResult = unknown[]>(
|
|
447
|
+
fn: <TRecord extends {} = any, TResult extends {} = unknown[]>(
|
|
381
448
|
this: Knex.QueryBuilder<TRecord, TResult>,
|
|
382
449
|
...args: any[]
|
|
383
|
-
) =>
|
|
450
|
+
) =>
|
|
451
|
+
| Knex.QueryBuilder<TRecord, TResult>
|
|
452
|
+
| Promise<
|
|
453
|
+
| Knex.QueryBuilder<TRecord | TResult>
|
|
454
|
+
| DeferredKeySelection.Resolve<TResult>
|
|
455
|
+
>
|
|
456
|
+
): void;
|
|
457
|
+
}
|
|
458
|
+
|
|
459
|
+
class TableBuilder {
|
|
460
|
+
static extend<T = Knex.TableBuilder, B = Knex.TableBuilder>(
|
|
461
|
+
methodName: string,
|
|
462
|
+
fn: (this: T, ...args: any[]) => B
|
|
463
|
+
): void;
|
|
464
|
+
}
|
|
465
|
+
class ViewBuilder {
|
|
466
|
+
static extend<T = Knex.ViewBuilder, B = Knex.ViewBuilder>(
|
|
467
|
+
methodName: string,
|
|
468
|
+
fn: (this: T, ...args: any[]) => B
|
|
469
|
+
): void;
|
|
470
|
+
}
|
|
471
|
+
class SchemaBuilder {
|
|
472
|
+
static extend<T = Knex.SchemaBuilder, B = Knex.SchemaBuilder>(
|
|
473
|
+
methodName: string,
|
|
474
|
+
fn: (this: T, ...args: any[]) => B
|
|
475
|
+
): void;
|
|
476
|
+
}
|
|
477
|
+
class ColumnBuilder {
|
|
478
|
+
static extend<T = Knex.ColumnBuilder, B = Knex.ColumnBuilder>(
|
|
479
|
+
methodName: string,
|
|
480
|
+
fn: (this: T, ...args: any[]) => B
|
|
384
481
|
): void;
|
|
385
482
|
}
|
|
386
483
|
|
|
@@ -405,6 +502,7 @@ export declare namespace Knex {
|
|
|
405
502
|
| Array<Date>
|
|
406
503
|
| Array<boolean>
|
|
407
504
|
| Buffer
|
|
505
|
+
| object
|
|
408
506
|
| Knex.Raw;
|
|
409
507
|
|
|
410
508
|
interface ValueDict extends Dict<Value | Knex.QueryBuilder> {}
|
|
@@ -423,15 +521,16 @@ export declare namespace Knex {
|
|
|
423
521
|
|
|
424
522
|
type TableDescriptor = string | Knex.Raw | Knex.QueryBuilder;
|
|
425
523
|
|
|
426
|
-
type Lookup<
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
TDefault
|
|
524
|
+
type Lookup<
|
|
525
|
+
TRegistry extends {},
|
|
526
|
+
TKey extends string,
|
|
527
|
+
TDefault = never
|
|
528
|
+
> = TKey extends keyof TRegistry ? TRegistry[TKey] : TDefault;
|
|
430
529
|
|
|
431
530
|
type MaybeRawColumn<TColumn> = TColumn | Raw<TColumn>;
|
|
432
531
|
|
|
433
532
|
type MaybeRawRecord<TRecord> = {
|
|
434
|
-
[K in keyof TRecord]: MaybeRawColumn<TRecord[K]
|
|
533
|
+
[K in keyof TRecord]: MaybeRawColumn<TRecord[K]>;
|
|
435
534
|
};
|
|
436
535
|
|
|
437
536
|
type DbColumn<TColumn> = Readonly<MaybeRawColumn<TColumn>>;
|
|
@@ -440,11 +539,16 @@ export declare namespace Knex {
|
|
|
440
539
|
|
|
441
540
|
type DbRecordArr<TRecord> = Readonly<MaybeArray<DbRecord<TRecord>>>;
|
|
442
541
|
|
|
443
|
-
export type CompositeTableType<
|
|
444
|
-
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
542
|
+
export type CompositeTableType<
|
|
543
|
+
TBase,
|
|
544
|
+
TInsert = TBase,
|
|
545
|
+
TUpdate = Partial<TInsert>,
|
|
546
|
+
TUpsert = Partial<TInsert>
|
|
547
|
+
> = {
|
|
548
|
+
base: TBase;
|
|
549
|
+
insert: TInsert;
|
|
550
|
+
update: TUpdate;
|
|
551
|
+
upsert: TUpsert;
|
|
448
552
|
};
|
|
449
553
|
|
|
450
554
|
type TableNames = keyof Tables;
|
|
@@ -453,20 +557,40 @@ export declare namespace Knex {
|
|
|
453
557
|
|
|
454
558
|
type TableType<TTable extends keyof Tables> = Tables[TTable];
|
|
455
559
|
|
|
456
|
-
type ResolveTableType<
|
|
560
|
+
type ResolveTableType<
|
|
561
|
+
TCompositeTableType,
|
|
562
|
+
TScope extends TableInterfaceScope = 'base'
|
|
563
|
+
> = TCompositeTableType extends CompositeTableType<unknown>
|
|
457
564
|
? TCompositeTableType[TScope]
|
|
458
565
|
: TCompositeTableType;
|
|
459
566
|
|
|
460
567
|
interface OnConflictQueryBuilder<TRecord extends {}, TResult> {
|
|
461
568
|
ignore(): QueryBuilder<TRecord, TResult>;
|
|
462
569
|
merge(mergeColumns?: (keyof TRecord)[]): QueryBuilder<TRecord, TResult>;
|
|
463
|
-
merge(
|
|
570
|
+
merge(
|
|
571
|
+
data?: Extract<DbRecord<ResolveTableType<TRecord, 'update'>>, object>
|
|
572
|
+
): QueryBuilder<TRecord, TResult>;
|
|
464
573
|
}
|
|
465
574
|
|
|
466
575
|
//
|
|
467
576
|
// QueryInterface
|
|
468
577
|
//
|
|
469
|
-
type ClearStatements =
|
|
578
|
+
type ClearStatements =
|
|
579
|
+
| 'with'
|
|
580
|
+
| 'select'
|
|
581
|
+
| 'columns'
|
|
582
|
+
| 'hintComments'
|
|
583
|
+
| 'where'
|
|
584
|
+
| 'union'
|
|
585
|
+
| 'using'
|
|
586
|
+
| 'join'
|
|
587
|
+
| 'group'
|
|
588
|
+
| 'order'
|
|
589
|
+
| 'having'
|
|
590
|
+
| 'limit'
|
|
591
|
+
| 'offset'
|
|
592
|
+
| 'counter'
|
|
593
|
+
| 'counters';
|
|
470
594
|
|
|
471
595
|
interface QueryInterface<TRecord extends {} = any, TResult = any> {
|
|
472
596
|
select: Select<TRecord, TResult>;
|
|
@@ -618,8 +742,8 @@ export declare namespace Knex {
|
|
|
618
742
|
any,
|
|
619
743
|
any
|
|
620
744
|
>
|
|
621
|
-
|
|
622
|
-
|
|
745
|
+
? DeferredKeySelection<TBase, never>[]
|
|
746
|
+
: TResult
|
|
623
747
|
>;
|
|
624
748
|
clearWhere(): QueryBuilder<TRecord, TResult>;
|
|
625
749
|
clearGroup(): QueryBuilder<TRecord, TResult>;
|
|
@@ -629,12 +753,26 @@ export declare namespace Knex {
|
|
|
629
753
|
clear(statement: ClearStatements): QueryBuilder<TRecord, TResult>;
|
|
630
754
|
|
|
631
755
|
// Paging
|
|
632
|
-
offset(
|
|
633
|
-
|
|
756
|
+
offset(
|
|
757
|
+
offset: number,
|
|
758
|
+
options?: boolean | Readonly<{ skipBinding?: boolean }>
|
|
759
|
+
): QueryBuilder<TRecord, TResult>;
|
|
760
|
+
limit(
|
|
761
|
+
limit: number,
|
|
762
|
+
options?: string | Readonly<{ skipBinding?: boolean }>
|
|
763
|
+
): QueryBuilder<TRecord, TResult>;
|
|
634
764
|
|
|
635
765
|
// Aggregation
|
|
636
|
-
count: AsymmetricAggregation<
|
|
637
|
-
|
|
766
|
+
count: AsymmetricAggregation<
|
|
767
|
+
TRecord,
|
|
768
|
+
TResult,
|
|
769
|
+
Lookup<ResultTypes.Registry, 'Count', number | string>
|
|
770
|
+
>;
|
|
771
|
+
countDistinct: AsymmetricAggregation<
|
|
772
|
+
TRecord,
|
|
773
|
+
TResult,
|
|
774
|
+
Lookup<ResultTypes.Registry, 'Count', number | string>
|
|
775
|
+
>;
|
|
638
776
|
min: TypePreservingAggregation<TRecord, TResult>;
|
|
639
777
|
max: TypePreservingAggregation<TRecord, TResult>;
|
|
640
778
|
sum: TypePreservingAggregation<TRecord, TResult>;
|
|
@@ -666,7 +804,10 @@ export declare namespace Knex {
|
|
|
666
804
|
rowNumber: AnalyticFunction<TRecord, TResult>;
|
|
667
805
|
|
|
668
806
|
// Others
|
|
669
|
-
first: Select<
|
|
807
|
+
first: Select<
|
|
808
|
+
TRecord,
|
|
809
|
+
DeferredKeySelection.AddUnionMember<UnwrapArrayMember<TResult>, undefined>
|
|
810
|
+
>;
|
|
670
811
|
|
|
671
812
|
pluck<K extends keyof TRecord>(
|
|
672
813
|
column: K
|
|
@@ -675,7 +816,9 @@ export declare namespace Knex {
|
|
|
675
816
|
|
|
676
817
|
insert(
|
|
677
818
|
data: TRecord extends CompositeTableType<unknown>
|
|
678
|
-
?
|
|
819
|
+
?
|
|
820
|
+
| ResolveTableType<TRecord, 'insert'>
|
|
821
|
+
| ReadonlyArray<ResolveTableType<TRecord, 'insert'>>
|
|
679
822
|
: DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>,
|
|
680
823
|
returning: '*',
|
|
681
824
|
options?: DMLOptions
|
|
@@ -689,7 +832,9 @@ export declare namespace Knex {
|
|
|
689
832
|
>[]
|
|
690
833
|
>(
|
|
691
834
|
data: TRecord extends CompositeTableType<unknown>
|
|
692
|
-
?
|
|
835
|
+
?
|
|
836
|
+
| ResolveTableType<TRecord, 'insert'>
|
|
837
|
+
| ReadonlyArray<ResolveTableType<TRecord, 'insert'>>
|
|
693
838
|
: DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>,
|
|
694
839
|
returning: TKey,
|
|
695
840
|
options?: DMLOptions
|
|
@@ -703,7 +848,9 @@ export declare namespace Knex {
|
|
|
703
848
|
>[]
|
|
704
849
|
>(
|
|
705
850
|
data: TRecord extends CompositeTableType<unknown>
|
|
706
|
-
?
|
|
851
|
+
?
|
|
852
|
+
| ResolveTableType<TRecord, 'insert'>
|
|
853
|
+
| ReadonlyArray<ResolveTableType<TRecord, 'insert'>>
|
|
707
854
|
: DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>,
|
|
708
855
|
returning: readonly TKey[],
|
|
709
856
|
options?: DMLOptions
|
|
@@ -717,7 +864,9 @@ export declare namespace Knex {
|
|
|
717
864
|
>[]
|
|
718
865
|
>(
|
|
719
866
|
data: TRecord extends CompositeTableType<unknown>
|
|
720
|
-
?
|
|
867
|
+
?
|
|
868
|
+
| ResolveTableType<TRecord, 'insert'>
|
|
869
|
+
| ReadonlyArray<ResolveTableType<TRecord, 'insert'>>
|
|
721
870
|
: DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>,
|
|
722
871
|
returning: TKey,
|
|
723
872
|
options?: DMLOptions
|
|
@@ -731,20 +880,26 @@ export declare namespace Knex {
|
|
|
731
880
|
>[]
|
|
732
881
|
>(
|
|
733
882
|
data: TRecord extends CompositeTableType<unknown>
|
|
734
|
-
?
|
|
883
|
+
?
|
|
884
|
+
| ResolveTableType<TRecord, 'insert'>
|
|
885
|
+
| ReadonlyArray<ResolveTableType<TRecord, 'insert'>>
|
|
735
886
|
: DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>,
|
|
736
887
|
returning: readonly TKey[],
|
|
737
888
|
options?: DMLOptions
|
|
738
889
|
): QueryBuilder<TRecord, TResult2>;
|
|
739
890
|
insert<TResult2 = number[]>(
|
|
740
891
|
data: TRecord extends CompositeTableType<unknown>
|
|
741
|
-
?
|
|
892
|
+
?
|
|
893
|
+
| ResolveTableType<TRecord, 'insert'>
|
|
894
|
+
| ReadonlyArray<ResolveTableType<TRecord, 'insert'>>
|
|
742
895
|
: DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>
|
|
743
896
|
): QueryBuilder<TRecord, TResult2>;
|
|
744
897
|
|
|
745
898
|
upsert(
|
|
746
899
|
data: TRecord extends CompositeTableType<unknown>
|
|
747
|
-
?
|
|
900
|
+
?
|
|
901
|
+
| ResolveTableType<TRecord, 'upsert'>
|
|
902
|
+
| ReadonlyArray<ResolveTableType<TRecord, 'upsert'>>
|
|
748
903
|
: DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>,
|
|
749
904
|
returning: '*',
|
|
750
905
|
options?: DMLOptions
|
|
@@ -755,10 +910,12 @@ export declare namespace Knex {
|
|
|
755
910
|
UnwrapArrayMember<TResult>,
|
|
756
911
|
ResolveTableType<TRecord>,
|
|
757
912
|
TKey
|
|
758
|
-
|
|
759
|
-
|
|
913
|
+
>[]
|
|
914
|
+
>(
|
|
760
915
|
data: TRecord extends CompositeTableType<unknown>
|
|
761
|
-
?
|
|
916
|
+
?
|
|
917
|
+
| ResolveTableType<TRecord, 'upsert'>
|
|
918
|
+
| ReadonlyArray<ResolveTableType<TRecord, 'upsert'>>
|
|
762
919
|
: DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>,
|
|
763
920
|
returning: TKey,
|
|
764
921
|
options?: DMLOptions
|
|
@@ -769,10 +926,12 @@ export declare namespace Knex {
|
|
|
769
926
|
UnwrapArrayMember<TResult>,
|
|
770
927
|
ResolveTableType<TRecord>,
|
|
771
928
|
TKey
|
|
772
|
-
|
|
773
|
-
|
|
929
|
+
>[]
|
|
930
|
+
>(
|
|
774
931
|
data: TRecord extends CompositeTableType<unknown>
|
|
775
|
-
?
|
|
932
|
+
?
|
|
933
|
+
| ResolveTableType<TRecord, 'upsert'>
|
|
934
|
+
| ReadonlyArray<ResolveTableType<TRecord, 'upsert'>>
|
|
776
935
|
: DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>,
|
|
777
936
|
returning: readonly TKey[],
|
|
778
937
|
options?: DMLOptions
|
|
@@ -783,10 +942,12 @@ export declare namespace Knex {
|
|
|
783
942
|
UnwrapArrayMember<TResult>,
|
|
784
943
|
TRecord,
|
|
785
944
|
TKey
|
|
786
|
-
|
|
787
|
-
|
|
945
|
+
>[]
|
|
946
|
+
>(
|
|
788
947
|
data: TRecord extends CompositeTableType<unknown>
|
|
789
|
-
?
|
|
948
|
+
?
|
|
949
|
+
| ResolveTableType<TRecord, 'upsert'>
|
|
950
|
+
| ReadonlyArray<ResolveTableType<TRecord, 'upsert'>>
|
|
790
951
|
: DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>,
|
|
791
952
|
returning: TKey,
|
|
792
953
|
options?: DMLOptions
|
|
@@ -797,17 +958,21 @@ export declare namespace Knex {
|
|
|
797
958
|
UnwrapArrayMember<TResult>,
|
|
798
959
|
TRecord,
|
|
799
960
|
TKey
|
|
800
|
-
|
|
801
|
-
|
|
961
|
+
>[]
|
|
962
|
+
>(
|
|
802
963
|
data: TRecord extends CompositeTableType<unknown>
|
|
803
|
-
?
|
|
964
|
+
?
|
|
965
|
+
| ResolveTableType<TRecord, 'upsert'>
|
|
966
|
+
| ReadonlyArray<ResolveTableType<TRecord, 'upsert'>>
|
|
804
967
|
: DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>,
|
|
805
968
|
returning: readonly TKey[],
|
|
806
969
|
options?: DMLOptions
|
|
807
970
|
): QueryBuilder<TRecord, TResult2>;
|
|
808
971
|
upsert<TResult2 = number[]>(
|
|
809
972
|
data: TRecord extends CompositeTableType<unknown>
|
|
810
|
-
?
|
|
973
|
+
?
|
|
974
|
+
| ResolveTableType<TRecord, 'upsert'>
|
|
975
|
+
| ReadonlyArray<ResolveTableType<TRecord, 'upsert'>>
|
|
811
976
|
: DbRecordArr<TRecord> | ReadonlyArray<DbRecordArr<TRecord>>
|
|
812
977
|
): QueryBuilder<TRecord, TResult2>;
|
|
813
978
|
|
|
@@ -866,7 +1031,9 @@ export declare namespace Knex {
|
|
|
866
1031
|
TKey
|
|
867
1032
|
>[]
|
|
868
1033
|
>(
|
|
869
|
-
data: TRecord extends CompositeTableType<unknown>
|
|
1034
|
+
data: TRecord extends CompositeTableType<unknown>
|
|
1035
|
+
? ResolveTableType<TRecord, 'update'>
|
|
1036
|
+
: DbRecordArr<TRecord>,
|
|
870
1037
|
returning: TKey,
|
|
871
1038
|
options?: DMLOptions
|
|
872
1039
|
): QueryBuilder<TRecord, TResult2>;
|
|
@@ -878,7 +1045,9 @@ export declare namespace Knex {
|
|
|
878
1045
|
TKey
|
|
879
1046
|
>[]
|
|
880
1047
|
>(
|
|
881
|
-
data: TRecord extends CompositeTableType<unknown>
|
|
1048
|
+
data: TRecord extends CompositeTableType<unknown>
|
|
1049
|
+
? ResolveTableType<TRecord, 'update'>
|
|
1050
|
+
: DbRecordArr<TRecord>,
|
|
882
1051
|
returning: readonly TKey[],
|
|
883
1052
|
options?: DMLOptions
|
|
884
1053
|
): QueryBuilder<TRecord, TResult2>;
|
|
@@ -890,7 +1059,9 @@ export declare namespace Knex {
|
|
|
890
1059
|
TKey
|
|
891
1060
|
>[]
|
|
892
1061
|
>(
|
|
893
|
-
data: TRecord extends CompositeTableType<unknown>
|
|
1062
|
+
data: TRecord extends CompositeTableType<unknown>
|
|
1063
|
+
? ResolveTableType<TRecord, 'update'>
|
|
1064
|
+
: DbRecordArr<TRecord>,
|
|
894
1065
|
returning: TKey | readonly TKey[],
|
|
895
1066
|
options?: DMLOptions
|
|
896
1067
|
): QueryBuilder<TRecord, TResult2>;
|
|
@@ -902,17 +1073,27 @@ export declare namespace Knex {
|
|
|
902
1073
|
TKey
|
|
903
1074
|
>[]
|
|
904
1075
|
>(
|
|
905
|
-
data: TRecord extends CompositeTableType<unknown>
|
|
1076
|
+
data: TRecord extends CompositeTableType<unknown>
|
|
1077
|
+
? ResolveTableType<TRecord, 'update'>
|
|
1078
|
+
: DbRecordArr<TRecord>,
|
|
906
1079
|
returning: readonly TKey[],
|
|
907
1080
|
options?: DMLOptions
|
|
908
1081
|
): QueryBuilder<TRecord, TResult2>;
|
|
909
1082
|
update<TResult2 = number>(
|
|
910
|
-
data: TRecord extends CompositeTableType<unknown>
|
|
1083
|
+
data: TRecord extends CompositeTableType<unknown>
|
|
1084
|
+
? ResolveTableType<TRecord, 'update'>
|
|
1085
|
+
: DbRecordArr<TRecord>
|
|
911
1086
|
): QueryBuilder<TRecord, TResult2>;
|
|
912
1087
|
|
|
913
|
-
update<TResult2 = number>(
|
|
1088
|
+
update<TResult2 = number>(
|
|
1089
|
+
columnName: string,
|
|
1090
|
+
value: Value
|
|
1091
|
+
): QueryBuilder<TRecord, TResult2>;
|
|
914
1092
|
|
|
915
|
-
returning(
|
|
1093
|
+
returning(
|
|
1094
|
+
column: '*',
|
|
1095
|
+
options?: DMLOptions
|
|
1096
|
+
): QueryBuilder<TRecord, DeferredKeySelection<TRecord, never>[]>;
|
|
916
1097
|
returning<
|
|
917
1098
|
TKey extends StrKey<ResolveTableType<TRecord>>,
|
|
918
1099
|
TResult2 = DeferredKeySelection.Augment<
|
|
@@ -927,7 +1108,11 @@ export declare namespace Knex {
|
|
|
927
1108
|
returning<
|
|
928
1109
|
TKey extends StrKey<ResolveTableType<TRecord>>,
|
|
929
1110
|
TResult2 = DeferredKeySelection.SetSingle<
|
|
930
|
-
DeferredKeySelection.Augment<
|
|
1111
|
+
DeferredKeySelection.Augment<
|
|
1112
|
+
UnwrapArrayMember<TResult>,
|
|
1113
|
+
ResolveTableType<TRecord>,
|
|
1114
|
+
TKey
|
|
1115
|
+
>,
|
|
931
1116
|
false
|
|
932
1117
|
>[]
|
|
933
1118
|
>(
|
|
@@ -939,28 +1124,18 @@ export declare namespace Knex {
|
|
|
939
1124
|
options?: DMLOptions
|
|
940
1125
|
): QueryBuilder<TRecord, TResult2>;
|
|
941
1126
|
|
|
942
|
-
onConflict<
|
|
943
|
-
TKey extends StrKey<ResolveTableType<TRecord>>
|
|
944
|
-
>(
|
|
1127
|
+
onConflict<TKey extends StrKey<ResolveTableType<TRecord>>>(
|
|
945
1128
|
column: TKey
|
|
946
1129
|
): OnConflictQueryBuilder<TRecord, TResult>;
|
|
947
|
-
onConflict<
|
|
948
|
-
TKey extends StrKey<ResolveTableType<TRecord>>
|
|
949
|
-
>(
|
|
1130
|
+
onConflict<TKey extends StrKey<ResolveTableType<TRecord>>>(
|
|
950
1131
|
columns: readonly TKey[]
|
|
951
1132
|
): OnConflictQueryBuilder<TRecord, TResult>;
|
|
952
1133
|
|
|
953
|
-
onConflict(
|
|
954
|
-
columns: string
|
|
955
|
-
): OnConflictQueryBuilder<TRecord, TResult>;
|
|
1134
|
+
onConflict(columns: string): OnConflictQueryBuilder<TRecord, TResult>;
|
|
956
1135
|
|
|
957
|
-
onConflict(
|
|
958
|
-
columns: string[]
|
|
959
|
-
): OnConflictQueryBuilder<TRecord, TResult>;
|
|
1136
|
+
onConflict(columns: string[]): OnConflictQueryBuilder<TRecord, TResult>;
|
|
960
1137
|
|
|
961
|
-
onConflict(
|
|
962
|
-
raw: Raw
|
|
963
|
-
): OnConflictQueryBuilder<TRecord, TResult>;
|
|
1138
|
+
onConflict(raw: Raw): OnConflictQueryBuilder<TRecord, TResult>;
|
|
964
1139
|
|
|
965
1140
|
onConflict(): OnConflictQueryBuilder<TRecord, TResult>;
|
|
966
1141
|
|
|
@@ -1036,79 +1211,98 @@ export declare namespace Knex {
|
|
|
1036
1211
|
(columnName: string): QueryBuilder<TRecord, TResult>;
|
|
1037
1212
|
}
|
|
1038
1213
|
|
|
1039
|
-
type IntersectAliases<AliasUT> =
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
AliasUT extends (infer I)[]
|
|
1214
|
+
type IntersectAliases<AliasUT> = UnionToIntersection<
|
|
1215
|
+
IncompatibleToAlt<
|
|
1216
|
+
AliasUT extends (infer I)[]
|
|
1043
1217
|
? I extends Ref<any, infer TMapping>
|
|
1044
|
-
|
|
1045
|
-
|
|
1218
|
+
? TMapping
|
|
1219
|
+
: I
|
|
1046
1220
|
: never,
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
|
|
1221
|
+
Dict,
|
|
1222
|
+
{}
|
|
1223
|
+
>
|
|
1224
|
+
> & {}; // filters out `null` and `undefined`
|
|
1051
1225
|
|
|
1052
1226
|
interface AliasQueryBuilder<TRecord extends {} = any, TResult = unknown[]> {
|
|
1053
1227
|
<
|
|
1054
1228
|
AliasUT extends InferrableColumnDescriptor<ResolveTableType<TRecord>>[],
|
|
1055
|
-
TResult2 = ArrayIfAlready<
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1229
|
+
TResult2 = ArrayIfAlready<
|
|
1230
|
+
TResult,
|
|
1231
|
+
DeferredKeySelection.Augment<
|
|
1232
|
+
UnwrapArrayMember<TResult>,
|
|
1233
|
+
ResolveTableType<TRecord>,
|
|
1234
|
+
IncompatibleToAlt<ArrayMember<AliasUT>, string, never>,
|
|
1235
|
+
IntersectAliases<AliasUT>
|
|
1236
|
+
>
|
|
1237
|
+
>
|
|
1238
|
+
>(
|
|
1062
1239
|
...aliases: AliasUT
|
|
1063
1240
|
): QueryBuilder<TRecord, TResult2>;
|
|
1064
1241
|
|
|
1065
1242
|
<
|
|
1066
1243
|
AliasUT extends InferrableColumnDescriptor<ResolveTableType<TRecord>>[],
|
|
1067
|
-
TResult2 = ArrayIfAlready<
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1244
|
+
TResult2 = ArrayIfAlready<
|
|
1245
|
+
TResult,
|
|
1246
|
+
DeferredKeySelection.Augment<
|
|
1247
|
+
UnwrapArrayMember<TResult>,
|
|
1248
|
+
ResolveTableType<TRecord>,
|
|
1249
|
+
IncompatibleToAlt<ArrayMember<AliasUT>, string, never>,
|
|
1250
|
+
IntersectAliases<AliasUT>
|
|
1251
|
+
>
|
|
1252
|
+
>
|
|
1253
|
+
>(
|
|
1074
1254
|
aliases: AliasUT
|
|
1075
1255
|
): QueryBuilder<TRecord, TResult2>;
|
|
1076
1256
|
|
|
1077
1257
|
<
|
|
1078
1258
|
AliasUT extends (Dict | string)[],
|
|
1079
|
-
TResult2 = ArrayIfAlready<
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1259
|
+
TResult2 = ArrayIfAlready<
|
|
1260
|
+
TResult,
|
|
1261
|
+
DeferredKeySelection.Augment<
|
|
1262
|
+
UnwrapArrayMember<TResult>,
|
|
1263
|
+
ResolveTableType<TRecord>,
|
|
1264
|
+
IncompatibleToAlt<ArrayMember<AliasUT>, string, never>,
|
|
1265
|
+
IntersectAliases<AliasUT>
|
|
1266
|
+
>
|
|
1267
|
+
>
|
|
1268
|
+
>(
|
|
1086
1269
|
...aliases: AliasUT
|
|
1087
1270
|
): QueryBuilder<TRecord, TResult2>;
|
|
1088
1271
|
|
|
1089
1272
|
<
|
|
1090
1273
|
AliasUT extends (Dict | string)[],
|
|
1091
|
-
TResult2 = ArrayIfAlready<
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1274
|
+
TResult2 = ArrayIfAlready<
|
|
1275
|
+
TResult,
|
|
1276
|
+
DeferredKeySelection.Augment<
|
|
1277
|
+
UnwrapArrayMember<TResult>,
|
|
1278
|
+
TRecord,
|
|
1279
|
+
IncompatibleToAlt<ArrayMember<AliasUT>, string, never>,
|
|
1280
|
+
IntersectAliases<AliasUT>
|
|
1281
|
+
>
|
|
1282
|
+
>
|
|
1283
|
+
>(
|
|
1098
1284
|
aliases: AliasUT
|
|
1099
1285
|
): QueryBuilder<TRecord, TResult2>;
|
|
1100
1286
|
}
|
|
1101
1287
|
|
|
1102
1288
|
interface Select<TRecord extends {} = any, TResult = unknown[]>
|
|
1103
1289
|
extends AliasQueryBuilder<TRecord, TResult>,
|
|
1104
|
-
|
|
1290
|
+
ColumnNameQueryBuilder<TRecord, TResult> {
|
|
1105
1291
|
(): QueryBuilder<TRecord, TResult>;
|
|
1106
1292
|
|
|
1107
|
-
<
|
|
1293
|
+
<
|
|
1294
|
+
TResult2 = ArrayIfAlready<TResult, any>,
|
|
1295
|
+
TInnerRecord extends {} = any,
|
|
1296
|
+
TInnerResult = any
|
|
1297
|
+
>(
|
|
1108
1298
|
...subQueryBuilders: readonly QueryBuilder<TInnerRecord, TInnerResult>[]
|
|
1109
1299
|
): QueryBuilder<TRecord, TResult2>;
|
|
1110
1300
|
|
|
1111
|
-
<
|
|
1301
|
+
<
|
|
1302
|
+
TResult2 = ArrayIfAlready<TResult, any>,
|
|
1303
|
+
TInnerRecord extends {} = any,
|
|
1304
|
+
TInnerResult = any
|
|
1305
|
+
>(
|
|
1112
1306
|
subQueryBuilders: readonly QueryBuilder<TInnerRecord, TInnerResult>[]
|
|
1113
1307
|
): QueryBuilder<TRecord, TResult2>;
|
|
1114
1308
|
}
|
|
@@ -1121,20 +1315,42 @@ export declare namespace Knex {
|
|
|
1121
1315
|
}
|
|
1122
1316
|
|
|
1123
1317
|
interface JsonExtract<TRecord extends {} = any, TResult = any> {
|
|
1124
|
-
(
|
|
1125
|
-
|
|
1318
|
+
(
|
|
1319
|
+
column: string | Raw | QueryBuilder,
|
|
1320
|
+
path: string,
|
|
1321
|
+
alias?: string,
|
|
1322
|
+
singleValue?: boolean
|
|
1323
|
+
): QueryBuilder<TRecord, TResult>;
|
|
1324
|
+
(column: JsonExtraction[] | any[][], singleValue?: boolean): QueryBuilder<
|
|
1325
|
+
TRecord,
|
|
1326
|
+
TResult
|
|
1327
|
+
>;
|
|
1126
1328
|
}
|
|
1127
1329
|
|
|
1128
1330
|
interface JsonSet<TRecord extends {} = any, TResult = any> {
|
|
1129
|
-
(
|
|
1331
|
+
(
|
|
1332
|
+
column: string | Raw | QueryBuilder,
|
|
1333
|
+
path: string,
|
|
1334
|
+
value: any,
|
|
1335
|
+
alias?: string
|
|
1336
|
+
): QueryBuilder<TRecord, TResult>;
|
|
1130
1337
|
}
|
|
1131
1338
|
|
|
1132
1339
|
interface JsonInsert<TRecord extends {} = any, TResult = any> {
|
|
1133
|
-
(
|
|
1340
|
+
(
|
|
1341
|
+
column: string | Raw | QueryBuilder,
|
|
1342
|
+
path: string,
|
|
1343
|
+
value: any,
|
|
1344
|
+
alias?: string
|
|
1345
|
+
): QueryBuilder<TRecord, TResult>;
|
|
1134
1346
|
}
|
|
1135
1347
|
|
|
1136
1348
|
interface JsonRemove<TRecord extends {} = any, TResult = any> {
|
|
1137
|
-
(
|
|
1349
|
+
(
|
|
1350
|
+
column: string | Raw | QueryBuilder,
|
|
1351
|
+
path: string,
|
|
1352
|
+
alias?: string
|
|
1353
|
+
): QueryBuilder<TRecord, TResult>;
|
|
1138
1354
|
}
|
|
1139
1355
|
|
|
1140
1356
|
interface HintComment<TRecord extends {} = any, TResult = any> {
|
|
@@ -1146,29 +1362,32 @@ export declare namespace Knex {
|
|
|
1146
1362
|
<
|
|
1147
1363
|
TTable extends TableNames,
|
|
1148
1364
|
TRecord2 extends {} = TableType<TTable>,
|
|
1149
|
-
TResult2 = DeferredKeySelection.ReplaceBase<
|
|
1150
|
-
|
|
1365
|
+
TResult2 = DeferredKeySelection.ReplaceBase<
|
|
1366
|
+
TResult,
|
|
1367
|
+
ResolveTableType<TRecord2>
|
|
1368
|
+
>
|
|
1369
|
+
>(
|
|
1151
1370
|
tableName: TTable,
|
|
1152
1371
|
options?: TableOptions
|
|
1153
1372
|
): QueryBuilder<TRecord2, TResult2>;
|
|
1154
1373
|
<
|
|
1155
1374
|
TRecord2 extends {} = {},
|
|
1156
1375
|
TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>
|
|
1157
|
-
|
|
1376
|
+
>(
|
|
1158
1377
|
tableName: TableDescriptor | AliasDict,
|
|
1159
1378
|
options?: TableOptions
|
|
1160
1379
|
): QueryBuilder<TRecord2, TResult2>;
|
|
1161
1380
|
<
|
|
1162
1381
|
TRecord2 extends {} = {},
|
|
1163
1382
|
TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>
|
|
1164
|
-
|
|
1383
|
+
>(
|
|
1165
1384
|
callback: Function,
|
|
1166
1385
|
options?: TableOptions
|
|
1167
1386
|
): QueryBuilder<TRecord2, TResult2>;
|
|
1168
1387
|
<
|
|
1169
1388
|
TRecord2 extends {} = {},
|
|
1170
1389
|
TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>
|
|
1171
|
-
|
|
1390
|
+
>(
|
|
1172
1391
|
raw: Raw,
|
|
1173
1392
|
options?: TableOptions
|
|
1174
1393
|
): QueryBuilder<TRecord2, TResult2>;
|
|
@@ -1199,15 +1418,15 @@ export declare namespace Knex {
|
|
|
1199
1418
|
TJoinTargetRecord extends {} = any,
|
|
1200
1419
|
TRecord2 extends {} = TRecord & TJoinTargetRecord,
|
|
1201
1420
|
TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>
|
|
1202
|
-
|
|
1421
|
+
>(
|
|
1203
1422
|
raw: Raw
|
|
1204
1423
|
): QueryBuilder<TRecord2, TResult2>;
|
|
1205
1424
|
<
|
|
1206
1425
|
TTable extends TableNames,
|
|
1207
1426
|
TRecord2 extends {} = ResolveTableType<TRecord> &
|
|
1208
|
-
|
|
1427
|
+
ResolveTableType<TableType<TTable>>,
|
|
1209
1428
|
TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>
|
|
1210
|
-
|
|
1429
|
+
>(
|
|
1211
1430
|
tableName: TTable,
|
|
1212
1431
|
clause: JoinCallback
|
|
1213
1432
|
): QueryBuilder<TRecord2, TResult2>;
|
|
@@ -1215,7 +1434,7 @@ export declare namespace Knex {
|
|
|
1215
1434
|
TJoinTargetRecord extends {} = any,
|
|
1216
1435
|
TRecord2 extends {} = TRecord & TJoinTargetRecord,
|
|
1217
1436
|
TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>
|
|
1218
|
-
|
|
1437
|
+
>(
|
|
1219
1438
|
tableName: TableDescriptor | AliasDict | QueryCallback,
|
|
1220
1439
|
clause: JoinCallback
|
|
1221
1440
|
): QueryBuilder<TRecord2, TResult2>;
|
|
@@ -1223,7 +1442,7 @@ export declare namespace Knex {
|
|
|
1223
1442
|
TJoinTargetRecord extends {} = any,
|
|
1224
1443
|
TRecord2 extends {} = TRecord & TJoinTargetRecord,
|
|
1225
1444
|
TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>
|
|
1226
|
-
|
|
1445
|
+
>(
|
|
1227
1446
|
tableName: TableDescriptor | AliasDict | QueryCallback,
|
|
1228
1447
|
columns: { [key: string]: string | number | boolean | Raw }
|
|
1229
1448
|
): QueryBuilder<TRecord2, TResult2>;
|
|
@@ -1231,19 +1450,20 @@ export declare namespace Knex {
|
|
|
1231
1450
|
TJoinTargetRecord extends {} = any,
|
|
1232
1451
|
TRecord2 extends {} = TRecord & TJoinTargetRecord,
|
|
1233
1452
|
TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>
|
|
1234
|
-
|
|
1453
|
+
>(
|
|
1235
1454
|
tableName: TableDescriptor | AliasDict | QueryCallback,
|
|
1236
1455
|
raw: Raw
|
|
1237
1456
|
): QueryBuilder<TRecord2, TResult2>;
|
|
1238
1457
|
<
|
|
1239
1458
|
TTable1 extends TableNames,
|
|
1240
1459
|
TTable2 extends TableNames,
|
|
1241
|
-
TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> &
|
|
1460
|
+
TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> &
|
|
1461
|
+
StrKey<TRecord1>,
|
|
1242
1462
|
TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>,
|
|
1243
1463
|
TRecord1 = ResolveTableType<TRecord>,
|
|
1244
1464
|
TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>,
|
|
1245
1465
|
TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>
|
|
1246
|
-
|
|
1466
|
+
>(
|
|
1247
1467
|
tableName: TTable2,
|
|
1248
1468
|
column1: `${TTable1}.${TKey1}`,
|
|
1249
1469
|
column2: `${TTable2}.${TKey2}`
|
|
@@ -1251,12 +1471,13 @@ export declare namespace Knex {
|
|
|
1251
1471
|
<
|
|
1252
1472
|
TTable1 extends TableNames,
|
|
1253
1473
|
TTable2 extends TableNames,
|
|
1254
|
-
TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> &
|
|
1474
|
+
TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> &
|
|
1475
|
+
StrKey<TRecord1>,
|
|
1255
1476
|
TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>,
|
|
1256
1477
|
TRecord1 = ResolveTableType<TRecord>,
|
|
1257
1478
|
TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>,
|
|
1258
1479
|
TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>
|
|
1259
|
-
|
|
1480
|
+
>(
|
|
1260
1481
|
tableName: TTable2,
|
|
1261
1482
|
column1: `${TTable2}.${TKey2}`,
|
|
1262
1483
|
column2: `${TTable1}.${TKey1}`
|
|
@@ -1265,7 +1486,7 @@ export declare namespace Knex {
|
|
|
1265
1486
|
TJoinTargetRecord extends {} = any,
|
|
1266
1487
|
TRecord2 extends {} = TRecord & TJoinTargetRecord,
|
|
1267
1488
|
TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>
|
|
1268
|
-
|
|
1489
|
+
>(
|
|
1269
1490
|
tableName: TableDescriptor | AliasDict | QueryCallback,
|
|
1270
1491
|
column1: string,
|
|
1271
1492
|
column2: string
|
|
@@ -1274,7 +1495,7 @@ export declare namespace Knex {
|
|
|
1274
1495
|
TJoinTargetRecord extends {} = any,
|
|
1275
1496
|
TRecord2 extends {} = TRecord & TJoinTargetRecord,
|
|
1276
1497
|
TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>
|
|
1277
|
-
|
|
1498
|
+
>(
|
|
1278
1499
|
tableName: TableDescriptor | AliasDict | QueryCallback,
|
|
1279
1500
|
column1: string,
|
|
1280
1501
|
raw: Raw
|
|
@@ -1282,12 +1503,13 @@ export declare namespace Knex {
|
|
|
1282
1503
|
<
|
|
1283
1504
|
TTable1 extends TableNames,
|
|
1284
1505
|
TTable2 extends TableNames,
|
|
1285
|
-
TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> &
|
|
1506
|
+
TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> &
|
|
1507
|
+
StrKey<TRecord1>,
|
|
1286
1508
|
TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>,
|
|
1287
1509
|
TRecord1 = ResolveTableType<TRecord>,
|
|
1288
1510
|
TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>,
|
|
1289
1511
|
TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>
|
|
1290
|
-
|
|
1512
|
+
>(
|
|
1291
1513
|
tableName: TTable2,
|
|
1292
1514
|
column1: `${TTable1}.${TKey1}`,
|
|
1293
1515
|
operator: string,
|
|
@@ -1296,22 +1518,23 @@ export declare namespace Knex {
|
|
|
1296
1518
|
<
|
|
1297
1519
|
TTable1 extends TableNames,
|
|
1298
1520
|
TTable2 extends TableNames,
|
|
1299
|
-
TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> &
|
|
1521
|
+
TKey1 extends StrKey<ResolveTableType<TableType<TTable1>>> &
|
|
1522
|
+
StrKey<TRecord1>,
|
|
1300
1523
|
TKey2 extends StrKey<ResolveTableType<TableType<TTable2>>>,
|
|
1301
1524
|
TRecord1 = ResolveTableType<TRecord>,
|
|
1302
1525
|
TRecord2 extends {} = TRecord1 & ResolveTableType<TableType<TTable2>>,
|
|
1303
1526
|
TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>
|
|
1304
|
-
|
|
1527
|
+
>(
|
|
1305
1528
|
tableName: TTable2,
|
|
1306
1529
|
column1: `${TTable2}.${TKey2}`,
|
|
1307
1530
|
operator: string,
|
|
1308
|
-
column2: `${TTable1}.${TKey1}
|
|
1531
|
+
column2: `${TTable1}.${TKey1}`
|
|
1309
1532
|
): QueryBuilder<TRecord2, TResult2>;
|
|
1310
1533
|
<
|
|
1311
1534
|
TJoinTargetRecord extends {} = any,
|
|
1312
1535
|
TRecord2 extends {} = TRecord & TJoinTargetRecord,
|
|
1313
1536
|
TResult2 = DeferredKeySelection.ReplaceBase<TResult, TRecord2>
|
|
1314
|
-
|
|
1537
|
+
>(
|
|
1315
1538
|
tableName: TableDescriptor | AliasDict | QueryCallback,
|
|
1316
1539
|
column1: string,
|
|
1317
1540
|
operator: string,
|
|
@@ -1368,8 +1591,18 @@ export declare namespace Knex {
|
|
|
1368
1591
|
onNotBetween(column1: string, range: readonly [any, any]): JoinClause;
|
|
1369
1592
|
andOnNotBetween(column1: string, range: readonly [any, any]): JoinClause;
|
|
1370
1593
|
orOnNotBetween(column1: string, range: readonly [any, any]): JoinClause;
|
|
1371
|
-
onJsonPathEquals(
|
|
1372
|
-
|
|
1594
|
+
onJsonPathEquals(
|
|
1595
|
+
columnFirst: string,
|
|
1596
|
+
jsonPathFirst: string,
|
|
1597
|
+
columnSecond: string,
|
|
1598
|
+
jsonPathSecond: string
|
|
1599
|
+
): JoinClause;
|
|
1600
|
+
orOnJsonPathEquals(
|
|
1601
|
+
columnFirst: string,
|
|
1602
|
+
jsonPathFirst: string,
|
|
1603
|
+
columnSecond: string,
|
|
1604
|
+
jsonPathSecond: string
|
|
1605
|
+
): JoinClause;
|
|
1373
1606
|
using(
|
|
1374
1607
|
column: string | readonly string[] | Raw | { [key: string]: string | Raw }
|
|
1375
1608
|
): JoinClause;
|
|
@@ -1389,19 +1622,26 @@ export declare namespace Knex {
|
|
|
1389
1622
|
|
|
1390
1623
|
interface With<TRecord extends {} = any, TResult = unknown[]>
|
|
1391
1624
|
extends WithRaw<TRecord, TResult>,
|
|
1392
|
-
|
|
1625
|
+
WithWrapped<TRecord, TResult> {}
|
|
1393
1626
|
|
|
1394
1627
|
interface WithRaw<TRecord extends {} = any, TResult = unknown[]> {
|
|
1395
1628
|
(alias: string, raw: Raw | QueryBuilder): QueryBuilder<TRecord, TResult>;
|
|
1396
|
-
(
|
|
1397
|
-
|
|
1398
|
-
|
|
1399
|
-
|
|
1400
|
-
|
|
1401
|
-
(
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1629
|
+
(
|
|
1630
|
+
alias: string,
|
|
1631
|
+
sql: string,
|
|
1632
|
+
bindings?: readonly Value[] | Object
|
|
1633
|
+
): QueryBuilder<TRecord, TResult>;
|
|
1634
|
+
(
|
|
1635
|
+
alias: string,
|
|
1636
|
+
columnList: string[],
|
|
1637
|
+
raw: Raw | QueryBuilder
|
|
1638
|
+
): QueryBuilder<TRecord, TResult>;
|
|
1639
|
+
(
|
|
1640
|
+
alias: string,
|
|
1641
|
+
columnList: string[],
|
|
1642
|
+
sql: string,
|
|
1643
|
+
bindings?: readonly Value[] | Object
|
|
1644
|
+
): QueryBuilder<TRecord, TResult>;
|
|
1405
1645
|
}
|
|
1406
1646
|
|
|
1407
1647
|
interface WithSchema<TRecord extends {} = any, TResult = unknown[]> {
|
|
@@ -1414,7 +1654,11 @@ export declare namespace Knex {
|
|
|
1414
1654
|
alias: string,
|
|
1415
1655
|
callback: (queryBuilder: QueryBuilder) => any
|
|
1416
1656
|
): QueryBuilder<TRecord, TResult>;
|
|
1417
|
-
(
|
|
1657
|
+
(
|
|
1658
|
+
alias: string,
|
|
1659
|
+
columnList: string[],
|
|
1660
|
+
queryBuilder: QueryBuilder
|
|
1661
|
+
): QueryBuilder<TRecord, TResult>;
|
|
1418
1662
|
(
|
|
1419
1663
|
alias: string,
|
|
1420
1664
|
columnList: string[],
|
|
@@ -1424,13 +1668,16 @@ export declare namespace Knex {
|
|
|
1424
1668
|
|
|
1425
1669
|
interface Where<TRecord extends {} = any, TResult = unknown>
|
|
1426
1670
|
extends WhereRaw<TRecord, TResult>,
|
|
1427
|
-
|
|
1428
|
-
|
|
1671
|
+
WhereWrapped<TRecord, TResult>,
|
|
1672
|
+
WhereNull<TRecord, TResult> {
|
|
1429
1673
|
(raw: Raw): QueryBuilder<TRecord, TResult>;
|
|
1430
1674
|
|
|
1431
1675
|
(callback: QueryCallback<TRecord, TResult>): QueryBuilder<TRecord, TResult>;
|
|
1432
1676
|
|
|
1433
|
-
(object: DbRecord<ResolveTableType<TRecord>>): QueryBuilder<
|
|
1677
|
+
(object: DbRecord<ResolveTableType<TRecord>>): QueryBuilder<
|
|
1678
|
+
TRecord,
|
|
1679
|
+
TResult
|
|
1680
|
+
>;
|
|
1434
1681
|
|
|
1435
1682
|
(object: Readonly<Object>): QueryBuilder<TRecord, TResult>;
|
|
1436
1683
|
|
|
@@ -1452,7 +1699,11 @@ export declare namespace Knex {
|
|
|
1452
1699
|
TResult
|
|
1453
1700
|
>;
|
|
1454
1701
|
|
|
1455
|
-
<
|
|
1702
|
+
<
|
|
1703
|
+
T extends keyof ResolveTableType<TRecord>,
|
|
1704
|
+
TRecordInner extends {},
|
|
1705
|
+
TResultInner
|
|
1706
|
+
>(
|
|
1456
1707
|
columnName: T,
|
|
1457
1708
|
operator: ComparisonOperator,
|
|
1458
1709
|
value: QueryBuilder<TRecordInner, TResultInner>
|
|
@@ -1495,7 +1746,10 @@ export declare namespace Knex {
|
|
|
1495
1746
|
columnName: K,
|
|
1496
1747
|
range: readonly [DbColumn<TRecord[K]>, DbColumn<TRecord[K]>]
|
|
1497
1748
|
): QueryBuilder<TRecord, TResult>;
|
|
1498
|
-
(columnName: string, range: readonly [Value, Value]): QueryBuilder<
|
|
1749
|
+
(columnName: string, range: readonly [Value, Value]): QueryBuilder<
|
|
1750
|
+
TRecord,
|
|
1751
|
+
TResult
|
|
1752
|
+
>;
|
|
1499
1753
|
}
|
|
1500
1754
|
|
|
1501
1755
|
interface WhereExists<TRecord extends {} = any, TResult = unknown[]> {
|
|
@@ -1506,11 +1760,16 @@ export declare namespace Knex {
|
|
|
1506
1760
|
}
|
|
1507
1761
|
|
|
1508
1762
|
interface WhereJsonObject<TRecord extends {} = any, TResult = unknown[]> {
|
|
1509
|
-
(columnName: keyof TRecord
|
|
1763
|
+
(columnName: keyof ResolveTableType<TRecord>, value: any): QueryBuilder<TRecord, TResult>;
|
|
1510
1764
|
}
|
|
1511
1765
|
|
|
1512
1766
|
interface WhereJsonPath<TRecord extends {} = any, TResult = unknown[]> {
|
|
1513
|
-
(
|
|
1767
|
+
(
|
|
1768
|
+
columnName: keyof ResolveTableType<TRecord>,
|
|
1769
|
+
jsonPath: string,
|
|
1770
|
+
operator: string,
|
|
1771
|
+
value: any
|
|
1772
|
+
): QueryBuilder<TRecord, TResult>;
|
|
1514
1773
|
}
|
|
1515
1774
|
|
|
1516
1775
|
interface WhereIn<TRecord extends {} = any, TResult = unknown[]> {
|
|
@@ -1518,18 +1777,20 @@ export declare namespace Knex {
|
|
|
1518
1777
|
columnName: K,
|
|
1519
1778
|
values: readonly DbColumn<ResolveTableType<TRecord>[K]>[] | QueryCallback
|
|
1520
1779
|
): QueryBuilder<TRecord, TResult>;
|
|
1521
|
-
(
|
|
1522
|
-
|
|
1523
|
-
|
|
1524
|
-
>;
|
|
1780
|
+
(
|
|
1781
|
+
columnName: string,
|
|
1782
|
+
values: readonly Value[] | QueryCallback
|
|
1783
|
+
): QueryBuilder<TRecord, TResult>;
|
|
1525
1784
|
<K extends keyof ResolveTableType<TRecord>>(
|
|
1526
1785
|
columnNames: readonly K[],
|
|
1527
|
-
values:
|
|
1786
|
+
values:
|
|
1787
|
+
| readonly (readonly DbColumn<ResolveTableType<TRecord>[K]>[])[]
|
|
1788
|
+
| QueryCallback
|
|
1789
|
+
): QueryBuilder<TRecord, TResult>;
|
|
1790
|
+
(
|
|
1791
|
+
columnNames: readonly string[],
|
|
1792
|
+
values: readonly Value[][] | QueryCallback
|
|
1528
1793
|
): QueryBuilder<TRecord, TResult>;
|
|
1529
|
-
(columnNames: readonly string[], values: readonly Value[][] | QueryCallback): QueryBuilder<
|
|
1530
|
-
TRecord,
|
|
1531
|
-
TResult
|
|
1532
|
-
>;
|
|
1533
1794
|
<K extends keyof TRecord, TRecordInner extends {}, TResultInner>(
|
|
1534
1795
|
columnName: K,
|
|
1535
1796
|
values: QueryBuilder<TRecordInner, TRecord[K]>
|
|
@@ -1552,11 +1813,18 @@ export declare namespace Knex {
|
|
|
1552
1813
|
// by extracting out a common base interface will not work because order of overloads
|
|
1553
1814
|
// is significant.
|
|
1554
1815
|
|
|
1555
|
-
interface AsymmetricAggregation<
|
|
1816
|
+
interface AsymmetricAggregation<
|
|
1817
|
+
TRecord extends {} = any,
|
|
1818
|
+
TResult = unknown[],
|
|
1819
|
+
TValue = any
|
|
1820
|
+
> {
|
|
1556
1821
|
<
|
|
1557
|
-
TOptions extends {
|
|
1558
|
-
TResult2 = AggregationQueryResult<
|
|
1559
|
-
|
|
1822
|
+
TOptions extends { as: string },
|
|
1823
|
+
TResult2 = AggregationQueryResult<
|
|
1824
|
+
TResult,
|
|
1825
|
+
{ [k in TOptions['as']]: TValue }
|
|
1826
|
+
>
|
|
1827
|
+
>(
|
|
1560
1828
|
columnName: Readonly<keyof ResolveTableType<TRecord>>,
|
|
1561
1829
|
options: Readonly<TOptions>
|
|
1562
1830
|
): QueryBuilder<TRecord, TResult2>;
|
|
@@ -1565,88 +1833,133 @@ export declare namespace Knex {
|
|
|
1565
1833
|
): QueryBuilder<TRecord, TResult2>;
|
|
1566
1834
|
<
|
|
1567
1835
|
TAliases extends {} = Record<string, string | string[] | Knex.Raw>,
|
|
1568
|
-
TResult2 = AggregationQueryResult<
|
|
1569
|
-
|
|
1836
|
+
TResult2 = AggregationQueryResult<
|
|
1837
|
+
TResult,
|
|
1838
|
+
{ [k in keyof TAliases]?: TValue }
|
|
1839
|
+
>
|
|
1840
|
+
>(
|
|
1841
|
+
aliases: TAliases
|
|
1842
|
+
): QueryBuilder<TRecord, TResult2>;
|
|
1570
1843
|
<TResult2 = AggregationQueryResult<TResult, Dict<TValue>>>(
|
|
1571
|
-
...columnNames: ReadonlyArray<
|
|
1844
|
+
...columnNames: ReadonlyArray<
|
|
1845
|
+
| Readonly<Record<string, string | string[] | Knex.Raw>>
|
|
1846
|
+
| Knex.Raw
|
|
1847
|
+
| string
|
|
1848
|
+
>
|
|
1572
1849
|
): QueryBuilder<TRecord, TResult2>;
|
|
1573
1850
|
}
|
|
1574
1851
|
|
|
1575
|
-
interface TypePreservingAggregation<
|
|
1852
|
+
interface TypePreservingAggregation<
|
|
1853
|
+
TRecord extends {} = any,
|
|
1854
|
+
TResult = unknown[],
|
|
1855
|
+
TValue = any
|
|
1856
|
+
> {
|
|
1576
1857
|
<
|
|
1577
1858
|
TKey extends keyof ResolveTableType<TRecord>,
|
|
1578
|
-
TOptions extends {
|
|
1579
|
-
TResult2 = AggregationQueryResult<
|
|
1580
|
-
|
|
1581
|
-
|
|
1582
|
-
|
|
1583
|
-
|
|
1859
|
+
TOptions extends { as: string },
|
|
1860
|
+
TResult2 = AggregationQueryResult<
|
|
1861
|
+
TResult,
|
|
1862
|
+
{
|
|
1863
|
+
[k in TOptions['as']]: ResolveTableType<TRecord>[TKey];
|
|
1864
|
+
}
|
|
1865
|
+
>
|
|
1866
|
+
>(
|
|
1867
|
+
columnName: TKey,
|
|
1584
1868
|
options: Readonly<TOptions>
|
|
1585
1869
|
): QueryBuilder<TRecord, TResult2>;
|
|
1586
1870
|
<
|
|
1587
1871
|
TKey extends keyof ResolveTableType<TRecord>,
|
|
1588
|
-
TResult2 = AggregationQueryResult<
|
|
1589
|
-
|
|
1872
|
+
TResult2 = AggregationQueryResult<
|
|
1873
|
+
TResult,
|
|
1874
|
+
Dict<ResolveTableType<TRecord>[TKey]>
|
|
1875
|
+
>
|
|
1876
|
+
>(
|
|
1590
1877
|
...columnNames: readonly TKey[]
|
|
1591
1878
|
): QueryBuilder<TRecord, TResult2>;
|
|
1592
1879
|
<
|
|
1593
|
-
TAliases extends {} = Readonly<
|
|
1594
|
-
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1598
|
-
|
|
1599
|
-
|
|
1600
|
-
|
|
1601
|
-
|
|
1880
|
+
TAliases extends {} = Readonly<
|
|
1881
|
+
Record<string, string | string[] | Knex.Raw>
|
|
1882
|
+
>,
|
|
1883
|
+
TResult2 = AggregationQueryResult<
|
|
1884
|
+
TResult,
|
|
1885
|
+
{
|
|
1886
|
+
// We have optional here because in most dialects aggregating by multiple keys simultaneously
|
|
1887
|
+
// causes rest of the keys to be dropped and only first to be considered
|
|
1888
|
+
[K in keyof TAliases]?: K extends keyof TRecord ? TRecord[K] : TValue;
|
|
1889
|
+
}
|
|
1890
|
+
>
|
|
1891
|
+
>(
|
|
1892
|
+
aliases: TAliases
|
|
1893
|
+
): QueryBuilder<TRecord, TResult2>;
|
|
1602
1894
|
<TResult2 = AggregationQueryResult<TResult, Dict<TValue>>>(
|
|
1603
|
-
...columnNames: ReadonlyArray<
|
|
1895
|
+
...columnNames: ReadonlyArray<
|
|
1896
|
+
| Readonly<Record<string, string | readonly string[] | Knex.Raw>>
|
|
1897
|
+
| Knex.Raw
|
|
1898
|
+
| string
|
|
1899
|
+
>
|
|
1604
1900
|
): QueryBuilder<TRecord, TResult2>;
|
|
1605
1901
|
}
|
|
1606
1902
|
|
|
1607
1903
|
interface AnalyticFunction<TRecord extends {} = any, TResult = unknown[]> {
|
|
1608
1904
|
<
|
|
1609
1905
|
TAlias extends string,
|
|
1610
|
-
TResult2 = AggregationQueryResult<TResult, {[x in TAlias]: number}>
|
|
1611
|
-
|
|
1906
|
+
TResult2 = AggregationQueryResult<TResult, { [x in TAlias]: number }>
|
|
1907
|
+
>(
|
|
1908
|
+
alias: TAlias,
|
|
1909
|
+
raw: Raw | QueryCallback<TRecord, TResult>
|
|
1910
|
+
): QueryBuilder<TRecord, TResult2>;
|
|
1612
1911
|
<
|
|
1613
1912
|
TAlias extends string,
|
|
1614
1913
|
TKey extends keyof ResolveTableType<TRecord>,
|
|
1615
|
-
TResult2 = AggregationQueryResult<TResult, {[x in TAlias]: number}>
|
|
1616
|
-
|
|
1617
|
-
|
|
1618
|
-
|
|
1619
|
-
|
|
1620
|
-
|
|
1621
|
-
|
|
1622
|
-
|
|
1914
|
+
TResult2 = AggregationQueryResult<TResult, { [x in TAlias]: number }>
|
|
1915
|
+
>(
|
|
1916
|
+
alias: TAlias,
|
|
1917
|
+
orderBy:
|
|
1918
|
+
| TKey
|
|
1919
|
+
| TKey[]
|
|
1920
|
+
| {
|
|
1921
|
+
column: TKey;
|
|
1922
|
+
order?: 'asc' | 'desc';
|
|
1923
|
+
nulls?: 'first' | 'last';
|
|
1924
|
+
},
|
|
1925
|
+
partitionBy?: TKey | TKey[] | { column: TKey; order?: 'asc' | 'desc' }
|
|
1926
|
+
): QueryBuilder<TRecord, TResult2>;
|
|
1623
1927
|
}
|
|
1624
1928
|
|
|
1625
1929
|
interface GroupBy<TRecord extends {} = any, TResult = unknown[]>
|
|
1626
1930
|
extends RawQueryBuilder<TRecord, TResult>,
|
|
1627
|
-
|
|
1931
|
+
ColumnNameQueryBuilder<TRecord, TResult> {}
|
|
1628
1932
|
|
|
1629
1933
|
interface OrderBy<TRecord extends {} = any, TResult = unknown[]> {
|
|
1630
|
-
(
|
|
1631
|
-
TRecord,
|
|
1632
|
-
|
|
1633
|
-
|
|
1634
|
-
|
|
1934
|
+
(
|
|
1935
|
+
columnName: keyof TRecord | QueryBuilder,
|
|
1936
|
+
order?: 'asc' | 'desc',
|
|
1937
|
+
nulls?: 'first' | 'last'
|
|
1938
|
+
): QueryBuilder<TRecord, TResult>;
|
|
1939
|
+
(
|
|
1940
|
+
columnName: string | QueryBuilder,
|
|
1941
|
+
order?: string,
|
|
1942
|
+
nulls?: string
|
|
1943
|
+
): QueryBuilder<TRecord, TResult>;
|
|
1635
1944
|
(
|
|
1636
1945
|
columnDefs: Array<
|
|
1637
|
-
keyof TRecord
|
|
1638
|
-
|
|
1639
|
-
|
|
1640
|
-
|
|
1641
|
-
|
|
1946
|
+
| keyof TRecord
|
|
1947
|
+
| Readonly<{
|
|
1948
|
+
column: keyof TRecord | QueryBuilder;
|
|
1949
|
+
order?: 'asc' | 'desc';
|
|
1950
|
+
nulls?: 'first' | 'last';
|
|
1951
|
+
}>
|
|
1642
1952
|
>
|
|
1643
1953
|
): QueryBuilder<TRecord, TResult>;
|
|
1644
1954
|
(
|
|
1645
|
-
columnDefs: Array<
|
|
1646
|
-
|
|
1647
|
-
|
|
1648
|
-
|
|
1649
|
-
|
|
1955
|
+
columnDefs: Array<
|
|
1956
|
+
| string
|
|
1957
|
+
| Readonly<{
|
|
1958
|
+
column: string | QueryBuilder;
|
|
1959
|
+
order?: string;
|
|
1960
|
+
nulls?: string;
|
|
1961
|
+
}>
|
|
1962
|
+
>
|
|
1650
1963
|
): QueryBuilder<TRecord, TResult>;
|
|
1651
1964
|
}
|
|
1652
1965
|
|
|
@@ -1680,10 +1993,7 @@ export declare namespace Knex {
|
|
|
1680
1993
|
value: Value | QueryBuilder | null
|
|
1681
1994
|
): QueryBuilder<TRecord, TResult>;
|
|
1682
1995
|
|
|
1683
|
-
(raw: Raw): QueryBuilder<
|
|
1684
|
-
TRecord,
|
|
1685
|
-
TResult
|
|
1686
|
-
>;
|
|
1996
|
+
(raw: Raw): QueryBuilder<TRecord, TResult>;
|
|
1687
1997
|
}
|
|
1688
1998
|
|
|
1689
1999
|
interface HavingRange<TRecord extends {} = any, TResult = unknown[]> {
|
|
@@ -1691,12 +2001,18 @@ export declare namespace Knex {
|
|
|
1691
2001
|
columnName: K,
|
|
1692
2002
|
values: readonly DbColumn<TRecord[K]>[]
|
|
1693
2003
|
): QueryBuilder<TRecord, TResult>;
|
|
1694
|
-
(columnName: string, values: readonly Value[]): QueryBuilder<
|
|
2004
|
+
(columnName: string, values: readonly Value[]): QueryBuilder<
|
|
2005
|
+
TRecord,
|
|
2006
|
+
TResult
|
|
2007
|
+
>;
|
|
1695
2008
|
}
|
|
1696
2009
|
|
|
1697
2010
|
// commons
|
|
1698
2011
|
|
|
1699
|
-
interface ColumnNameQueryBuilder<
|
|
2012
|
+
interface ColumnNameQueryBuilder<
|
|
2013
|
+
TRecord extends {} = any,
|
|
2014
|
+
TResult = unknown[]
|
|
2015
|
+
> {
|
|
1700
2016
|
// When all columns are known to be keys of original record,
|
|
1701
2017
|
// we can extend our selection by these columns
|
|
1702
2018
|
(columnName: '*'): QueryBuilder<
|
|
@@ -1711,7 +2027,7 @@ export declare namespace Knex {
|
|
|
1711
2027
|
ResolveTableType<TRecord>,
|
|
1712
2028
|
ColNameUT & string
|
|
1713
2029
|
>[]
|
|
1714
|
-
|
|
2030
|
+
>(
|
|
1715
2031
|
...columnNames: readonly ColNameUT[]
|
|
1716
2032
|
): QueryBuilder<TRecord, TResult2>;
|
|
1717
2033
|
|
|
@@ -1722,7 +2038,7 @@ export declare namespace Knex {
|
|
|
1722
2038
|
ResolveTableType<TRecord>,
|
|
1723
2039
|
ColNameUT & string
|
|
1724
2040
|
>[]
|
|
1725
|
-
|
|
2041
|
+
>(
|
|
1726
2042
|
columnNames: readonly ColNameUT[]
|
|
1727
2043
|
): QueryBuilder<TRecord, TResult2>;
|
|
1728
2044
|
|
|
@@ -1734,7 +2050,7 @@ export declare namespace Knex {
|
|
|
1734
2050
|
SafePartial<TRecord>,
|
|
1735
2051
|
keyof TRecord & string
|
|
1736
2052
|
>[]
|
|
1737
|
-
|
|
2053
|
+
>(
|
|
1738
2054
|
...columnNames: readonly ColumnDescriptor<TRecord, TResult>[]
|
|
1739
2055
|
): QueryBuilder<TRecord, TResult2>;
|
|
1740
2056
|
|
|
@@ -1744,7 +2060,7 @@ export declare namespace Knex {
|
|
|
1744
2060
|
SafePartial<TRecord>,
|
|
1745
2061
|
keyof TRecord & string
|
|
1746
2062
|
>[]
|
|
1747
|
-
|
|
2063
|
+
>(
|
|
1748
2064
|
columnNames: readonly ColumnDescriptor<TRecord, TResult>[]
|
|
1749
2065
|
): QueryBuilder<TRecord, TResult2>;
|
|
1750
2066
|
}
|
|
@@ -1756,18 +2072,15 @@ export declare namespace Knex {
|
|
|
1756
2072
|
sql: string,
|
|
1757
2073
|
bindings?: readonly RawBinding[] | ValueDict | RawBinding
|
|
1758
2074
|
): QueryBuilder<TRecord, TResult2>;
|
|
1759
|
-
<TResult2 = TResult>(raw: Raw<TResult2>): QueryBuilder<
|
|
1760
|
-
TRecord,
|
|
1761
|
-
TResult2
|
|
1762
|
-
>;
|
|
2075
|
+
<TResult2 = TResult>(raw: Raw<TResult2>): QueryBuilder<TRecord, TResult2>;
|
|
1763
2076
|
}
|
|
1764
2077
|
|
|
1765
2078
|
// Raw
|
|
1766
2079
|
|
|
1767
2080
|
interface Raw<TResult = any>
|
|
1768
2081
|
extends events.EventEmitter,
|
|
1769
|
-
|
|
1770
|
-
timeout(ms: number, options?: {cancel?: boolean}): Raw<TResult>;
|
|
2082
|
+
ChainableInterface<ResolveResult<TResult>> {
|
|
2083
|
+
timeout(ms: number, options?: { cancel?: boolean }): Raw<TResult>;
|
|
1771
2084
|
wrap<TResult2 = TResult>(before: string, after: string): Raw<TResult>;
|
|
1772
2085
|
toSQL(): Sql;
|
|
1773
2086
|
queryContext(context: any): Raw<TResult>;
|
|
@@ -1776,8 +2089,14 @@ export declare namespace Knex {
|
|
|
1776
2089
|
|
|
1777
2090
|
interface RawBuilder<TRecord extends {} = any, TResult = any> {
|
|
1778
2091
|
<TResult2 = TResult>(value: Value): Raw<TResult2>;
|
|
1779
|
-
<TResult2 = TResult>(
|
|
1780
|
-
|
|
2092
|
+
<TResult2 = TResult>(
|
|
2093
|
+
sql: string,
|
|
2094
|
+
...bindings: readonly RawBinding[]
|
|
2095
|
+
): Raw<TResult2>;
|
|
2096
|
+
<TResult2 = TResult>(
|
|
2097
|
+
sql: string,
|
|
2098
|
+
bindings: readonly RawBinding[] | ValueDict
|
|
2099
|
+
): Raw<TResult2>;
|
|
1781
2100
|
}
|
|
1782
2101
|
|
|
1783
2102
|
const RefMemberTag: unique symbol;
|
|
@@ -1795,21 +2114,26 @@ export declare namespace Knex {
|
|
|
1795
2114
|
// Because unique symbol is used here, there is no way to actually
|
|
1796
2115
|
// access this at runtime
|
|
1797
2116
|
[RefMemberTag]: {
|
|
1798
|
-
src: TSrc
|
|
1799
|
-
mapping: TMapping
|
|
2117
|
+
src: TSrc;
|
|
2118
|
+
mapping: TMapping;
|
|
1800
2119
|
};
|
|
1801
2120
|
withSchema(schema: string): this;
|
|
1802
|
-
as<TAlias extends string>(
|
|
2121
|
+
as<TAlias extends string>(
|
|
2122
|
+
alias: TAlias
|
|
2123
|
+
): Ref<TSrc, { [K in TAlias]: TSrc }>;
|
|
1803
2124
|
}
|
|
1804
2125
|
|
|
1805
2126
|
interface RefBuilder {
|
|
1806
|
-
<TSrc extends string>(src: TSrc): Ref<TSrc, {[K in TSrc]: TSrc}>;
|
|
2127
|
+
<TSrc extends string>(src: TSrc): Ref<TSrc, { [K in TSrc]: TSrc }>;
|
|
1807
2128
|
}
|
|
1808
2129
|
|
|
1809
|
-
interface BatchInsertBuilder<TRecord extends {} = any, TResult = number[]>
|
|
2130
|
+
interface BatchInsertBuilder<TRecord extends {} = any, TResult = number[]>
|
|
2131
|
+
extends Promise<ResolveResult<TResult>> {
|
|
1810
2132
|
transacting(trx: Transaction): this;
|
|
1811
2133
|
// see returning methods from QueryInterface
|
|
1812
|
-
returning(
|
|
2134
|
+
returning(
|
|
2135
|
+
column: '*'
|
|
2136
|
+
): BatchInsertBuilder<TRecord, DeferredKeySelection<TRecord, never>[]>;
|
|
1813
2137
|
returning<
|
|
1814
2138
|
TKey extends StrKey<ResolveTableType<TRecord>>,
|
|
1815
2139
|
TResult2 = DeferredKeySelection.Augment<
|
|
@@ -1823,7 +2147,11 @@ export declare namespace Knex {
|
|
|
1823
2147
|
returning<
|
|
1824
2148
|
TKey extends StrKey<ResolveTableType<TRecord>>,
|
|
1825
2149
|
TResult2 = DeferredKeySelection.SetSingle<
|
|
1826
|
-
DeferredKeySelection.Augment<
|
|
2150
|
+
DeferredKeySelection.Augment<
|
|
2151
|
+
UnwrapArrayMember<TResult>,
|
|
2152
|
+
ResolveTableType<TRecord>,
|
|
2153
|
+
TKey
|
|
2154
|
+
>,
|
|
1827
2155
|
false
|
|
1828
2156
|
>[]
|
|
1829
2157
|
>(
|
|
@@ -1831,7 +2159,9 @@ export declare namespace Knex {
|
|
|
1831
2159
|
): BatchInsertBuilder<TRecord, TResult2>;
|
|
1832
2160
|
// if data with specific type passed, exclude this method
|
|
1833
2161
|
returning<TResult2 = SafePartial<TRecord>[]>(
|
|
1834
|
-
column: unknown extends TRecord
|
|
2162
|
+
column: unknown extends TRecord
|
|
2163
|
+
? string | readonly (string | Raw)[] | Raw
|
|
2164
|
+
: never
|
|
1835
2165
|
): BatchInsertBuilder<TRecord, TResult2>;
|
|
1836
2166
|
}
|
|
1837
2167
|
|
|
@@ -1850,20 +2180,21 @@ export declare namespace Knex {
|
|
|
1850
2180
|
...args: any[]
|
|
1851
2181
|
) => void;
|
|
1852
2182
|
|
|
1853
|
-
interface QueryBuilder<
|
|
1854
|
-
TRecord extends {} = any,
|
|
1855
|
-
TResult = any
|
|
1856
|
-
>
|
|
2183
|
+
interface QueryBuilder<TRecord extends {} = any, TResult = any>
|
|
1857
2184
|
extends QueryInterface<TRecord, TResult>,
|
|
1858
|
-
|
|
2185
|
+
ChainableInterface<ResolveResult<TResult>> {
|
|
1859
2186
|
client: Client;
|
|
1860
2187
|
or: QueryBuilder<TRecord, TResult>;
|
|
1861
2188
|
not: QueryBuilder<TRecord, TResult>;
|
|
1862
2189
|
and: QueryBuilder<TRecord, TResult>;
|
|
1863
2190
|
|
|
1864
2191
|
// TODO: Promise?
|
|
1865
|
-
columnInfo(
|
|
1866
|
-
|
|
2192
|
+
columnInfo(
|
|
2193
|
+
column: keyof DeferredKeySelection.Resolve<TRecord>
|
|
2194
|
+
): Promise<ColumnInfo>;
|
|
2195
|
+
columnInfo(): Promise<
|
|
2196
|
+
Record<keyof DeferredKeySelection.Resolve<TRecord>, ColumnInfo>
|
|
2197
|
+
>;
|
|
1867
2198
|
|
|
1868
2199
|
forUpdate(...tableNames: string[]): QueryBuilder<TRecord, TResult>;
|
|
1869
2200
|
forUpdate(tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;
|
|
@@ -1872,7 +2203,9 @@ export declare namespace Knex {
|
|
|
1872
2203
|
forShare(tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;
|
|
1873
2204
|
|
|
1874
2205
|
forNoKeyUpdate(...tableNames: string[]): QueryBuilder<TRecord, TResult>;
|
|
1875
|
-
forNoKeyUpdate(
|
|
2206
|
+
forNoKeyUpdate(
|
|
2207
|
+
tableNames: readonly string[]
|
|
2208
|
+
): QueryBuilder<TRecord, TResult>;
|
|
1876
2209
|
|
|
1877
2210
|
forKeyShare(...tableNames: string[]): QueryBuilder<TRecord, TResult>;
|
|
1878
2211
|
forKeyShare(tableNames: readonly string[]): QueryBuilder<TRecord, TResult>;
|
|
@@ -1888,7 +2221,10 @@ export declare namespace Knex {
|
|
|
1888
2221
|
queryContext(): any;
|
|
1889
2222
|
|
|
1890
2223
|
clone(): QueryBuilder<TRecord, TResult>;
|
|
1891
|
-
timeout(
|
|
2224
|
+
timeout(
|
|
2225
|
+
ms: number,
|
|
2226
|
+
options?: { cancel?: boolean }
|
|
2227
|
+
): QueryBuilder<TRecord, TResult>;
|
|
1892
2228
|
}
|
|
1893
2229
|
|
|
1894
2230
|
interface Sql {
|
|
@@ -1908,16 +2244,20 @@ export declare namespace Knex {
|
|
|
1908
2244
|
// Chainable interface
|
|
1909
2245
|
//
|
|
1910
2246
|
|
|
1911
|
-
type ExposedPromiseKeys =
|
|
1912
|
-
| "then"
|
|
1913
|
-
| "catch"
|
|
1914
|
-
| "finally";
|
|
2247
|
+
type ExposedPromiseKeys = 'then' | 'catch' | 'finally';
|
|
1915
2248
|
|
|
1916
2249
|
interface StringTagSupport {
|
|
1917
2250
|
readonly [Symbol.toStringTag]: string;
|
|
1918
2251
|
}
|
|
1919
|
-
interface ChainableInterface<T = any>
|
|
1920
|
-
|
|
2252
|
+
interface ChainableInterface<T = any>
|
|
2253
|
+
extends Pick<Promise<T>, keyof Promise<T> & ExposedPromiseKeys>,
|
|
2254
|
+
StringTagSupport {
|
|
2255
|
+
generateDdlCommands(): Promise<{
|
|
2256
|
+
pre: string[];
|
|
2257
|
+
sql: string[];
|
|
2258
|
+
check: string | null;
|
|
2259
|
+
post: string[];
|
|
2260
|
+
}>;
|
|
1921
2261
|
toQuery(): string;
|
|
1922
2262
|
options(options: Readonly<{ [key: string]: any }>): this;
|
|
1923
2263
|
connection(connection: any): this;
|
|
@@ -1928,7 +2268,9 @@ export declare namespace Knex {
|
|
|
1928
2268
|
options: Readonly<{ [key: string]: any }>,
|
|
1929
2269
|
handler: (readable: stream.PassThrough) => any
|
|
1930
2270
|
): Promise<any>;
|
|
1931
|
-
stream(
|
|
2271
|
+
stream(
|
|
2272
|
+
options?: Readonly<{ [key: string]: any }>
|
|
2273
|
+
): stream.PassThrough & AsyncIterable<ArrayMember<T>>;
|
|
1932
2274
|
pipe<T extends NodeJS.WritableStream>(
|
|
1933
2275
|
writable: T,
|
|
1934
2276
|
options?: Readonly<{ [key: string]: any }>
|
|
@@ -1937,7 +2279,12 @@ export declare namespace Knex {
|
|
|
1937
2279
|
}
|
|
1938
2280
|
|
|
1939
2281
|
// Not all of these are possible for all drivers, notably, sqlite doesn't support any of these
|
|
1940
|
-
type IsolationLevels =
|
|
2282
|
+
type IsolationLevels =
|
|
2283
|
+
| 'read uncommitted'
|
|
2284
|
+
| 'read committed'
|
|
2285
|
+
| 'snapshot'
|
|
2286
|
+
| 'repeatable read'
|
|
2287
|
+
| 'serializable';
|
|
1941
2288
|
interface TransactionConfig {
|
|
1942
2289
|
isolationLevel?: IsolationLevels;
|
|
1943
2290
|
userParams?: Record<string, any>;
|
|
@@ -1956,9 +2303,7 @@ export declare namespace Knex {
|
|
|
1956
2303
|
status: any,
|
|
1957
2304
|
value: any
|
|
1958
2305
|
): QueryBuilder<TRecord, TResult>;
|
|
1959
|
-
savepoint<T = any>(
|
|
1960
|
-
transactionScope: (trx: Transaction) => any
|
|
1961
|
-
): Promise<T>;
|
|
2306
|
+
savepoint<T = any>(transactionScope: (trx: Transaction) => any): Promise<T>;
|
|
1962
2307
|
commit(value?: any): QueryBuilder<TRecord, TResult>;
|
|
1963
2308
|
rollback(error?: any): QueryBuilder<TRecord, TResult>;
|
|
1964
2309
|
}
|
|
@@ -1983,7 +2328,10 @@ export declare namespace Knex {
|
|
|
1983
2328
|
viewName: string,
|
|
1984
2329
|
callback: (viewBuilder: ViewBuilder) => any
|
|
1985
2330
|
): SchemaBuilder;
|
|
1986
|
-
refreshMaterializedView(
|
|
2331
|
+
refreshMaterializedView(
|
|
2332
|
+
viewName: string,
|
|
2333
|
+
concurrently?: boolean
|
|
2334
|
+
): SchemaBuilder;
|
|
1987
2335
|
dropView(viewName: string): SchemaBuilder;
|
|
1988
2336
|
dropViewIfExists(viewName: string): SchemaBuilder;
|
|
1989
2337
|
dropMaterializedView(viewName: string): SchemaBuilder;
|
|
@@ -2077,19 +2425,36 @@ export declare namespace Knex {
|
|
|
2077
2425
|
): ColumnBuilder;
|
|
2078
2426
|
boolean(columnName: string): ColumnBuilder;
|
|
2079
2427
|
date(columnName: string): ColumnBuilder;
|
|
2080
|
-
dateTime(
|
|
2081
|
-
|
|
2428
|
+
dateTime(
|
|
2429
|
+
columnName: string,
|
|
2430
|
+
options?: Readonly<{ useTz?: boolean; precision?: number }>
|
|
2431
|
+
): ColumnBuilder;
|
|
2432
|
+
datetime(
|
|
2433
|
+
columnName: string,
|
|
2434
|
+
options?: Readonly<{ useTz?: boolean; precision?: number }>
|
|
2435
|
+
): ColumnBuilder;
|
|
2082
2436
|
time(columnName: string): ColumnBuilder;
|
|
2083
|
-
timestamp(
|
|
2437
|
+
timestamp(
|
|
2438
|
+
columnName: string,
|
|
2439
|
+
options?: Readonly<{ useTz?: boolean; precision?: number }>
|
|
2440
|
+
): ColumnBuilder;
|
|
2084
2441
|
/** @deprecated */
|
|
2085
|
-
timestamp(
|
|
2442
|
+
timestamp(
|
|
2443
|
+
columnName: string,
|
|
2444
|
+
withoutTz?: boolean,
|
|
2445
|
+
precision?: number
|
|
2446
|
+
): ColumnBuilder;
|
|
2086
2447
|
timestamps(
|
|
2087
2448
|
useTimestamps?: boolean,
|
|
2088
2449
|
defaultToNow?: boolean,
|
|
2089
2450
|
useCamelCase?: boolean
|
|
2090
2451
|
): ColumnBuilder;
|
|
2091
2452
|
timestamps(
|
|
2092
|
-
options?: Readonly<{
|
|
2453
|
+
options?: Readonly<{
|
|
2454
|
+
useTimestamps?: boolean;
|
|
2455
|
+
defaultToNow?: boolean;
|
|
2456
|
+
useCamelCase?: boolean;
|
|
2457
|
+
}>
|
|
2093
2458
|
): void;
|
|
2094
2459
|
geometry(columnName: string): ColumnBuilder;
|
|
2095
2460
|
geography(columnName: string): ColumnBuilder;
|
|
@@ -2097,22 +2462,34 @@ export declare namespace Knex {
|
|
|
2097
2462
|
binary(columnName: string, length?: number): ColumnBuilder;
|
|
2098
2463
|
enum(
|
|
2099
2464
|
columnName: string,
|
|
2100
|
-
values:
|
|
2465
|
+
values: readonly Value[] | null,
|
|
2101
2466
|
options?: EnumOptions
|
|
2102
2467
|
): ColumnBuilder;
|
|
2103
2468
|
enu(
|
|
2104
2469
|
columnName: string,
|
|
2105
|
-
values:
|
|
2470
|
+
values: readonly Value[] | null,
|
|
2106
2471
|
options?: EnumOptions
|
|
2107
2472
|
): ColumnBuilder;
|
|
2108
2473
|
json(columnName: string): ColumnBuilder;
|
|
2109
2474
|
jsonb(columnName: string): ColumnBuilder;
|
|
2110
|
-
uuid(
|
|
2475
|
+
uuid(
|
|
2476
|
+
columnName: string,
|
|
2477
|
+
options?: Readonly<{ useBinaryUuid?: boolean; primaryKey?: boolean }>
|
|
2478
|
+
): ColumnBuilder;
|
|
2111
2479
|
comment(val: string): void;
|
|
2112
2480
|
specificType(columnName: string, type: string): ColumnBuilder;
|
|
2113
|
-
primary(
|
|
2481
|
+
primary(
|
|
2482
|
+
columnNames: readonly string[],
|
|
2483
|
+
options?: Readonly<{
|
|
2484
|
+
constraintName?: string;
|
|
2485
|
+
deferrable?: deferrableType;
|
|
2486
|
+
}>
|
|
2487
|
+
): TableBuilder;
|
|
2114
2488
|
/** @deprecated */
|
|
2115
|
-
primary(
|
|
2489
|
+
primary(
|
|
2490
|
+
columnNames: readonly string[],
|
|
2491
|
+
constraintName?: string
|
|
2492
|
+
): TableBuilder;
|
|
2116
2493
|
index(
|
|
2117
2494
|
columnNames: string | readonly (string | Raw)[],
|
|
2118
2495
|
indexName?: string,
|
|
@@ -2121,23 +2498,51 @@ export declare namespace Knex {
|
|
|
2121
2498
|
index(
|
|
2122
2499
|
columnNames: string | readonly (string | Raw)[],
|
|
2123
2500
|
indexName?: string,
|
|
2124
|
-
options?: Readonly<{
|
|
2501
|
+
options?: Readonly<{
|
|
2502
|
+
indexType?: string;
|
|
2503
|
+
storageEngineIndexType?: storageEngineIndexType;
|
|
2504
|
+
predicate?: QueryBuilder;
|
|
2505
|
+
}>
|
|
2125
2506
|
): TableBuilder;
|
|
2126
2507
|
setNullable(column: string): TableBuilder;
|
|
2127
2508
|
dropNullable(column: string): TableBuilder;
|
|
2128
|
-
unique(
|
|
2509
|
+
unique(
|
|
2510
|
+
columnNames: readonly (string | Raw)[],
|
|
2511
|
+
options?: Readonly<{
|
|
2512
|
+
indexName?: string;
|
|
2513
|
+
storageEngineIndexType?: string;
|
|
2514
|
+
deferrable?: deferrableType;
|
|
2515
|
+
useConstraint?: boolean;
|
|
2516
|
+
}>
|
|
2517
|
+
): TableBuilder;
|
|
2129
2518
|
/** @deprecated */
|
|
2130
|
-
unique(
|
|
2519
|
+
unique(
|
|
2520
|
+
columnNames: readonly (string | Raw)[],
|
|
2521
|
+
indexName?: string
|
|
2522
|
+
): TableBuilder;
|
|
2131
2523
|
foreign(column: string, foreignKeyName?: string): ForeignConstraintBuilder;
|
|
2132
2524
|
foreign(
|
|
2133
2525
|
columns: readonly string[],
|
|
2134
2526
|
foreignKeyName?: string
|
|
2135
2527
|
): MultikeyForeignConstraintBuilder;
|
|
2136
|
-
check(
|
|
2137
|
-
|
|
2138
|
-
|
|
2528
|
+
check(
|
|
2529
|
+
checkPredicate: string,
|
|
2530
|
+
bindings?: Record<string, any>,
|
|
2531
|
+
constraintName?: string
|
|
2532
|
+
): TableBuilder;
|
|
2533
|
+
dropForeign(
|
|
2534
|
+
columnNames: string | readonly string[],
|
|
2535
|
+
foreignKeyName?: string
|
|
2536
|
+
): TableBuilder;
|
|
2537
|
+
dropUnique(
|
|
2538
|
+
columnNames: readonly (string | Raw)[],
|
|
2539
|
+
indexName?: string
|
|
2540
|
+
): TableBuilder;
|
|
2139
2541
|
dropPrimary(constraintName?: string): TableBuilder;
|
|
2140
|
-
dropIndex(
|
|
2542
|
+
dropIndex(
|
|
2543
|
+
columnNames: string | readonly (string | Raw)[],
|
|
2544
|
+
indexName?: string
|
|
2545
|
+
): TableBuilder;
|
|
2141
2546
|
dropTimestamps(useCamelCase?: boolean): TableBuilder;
|
|
2142
2547
|
dropChecks(checkConstraintNames: string | string[]): TableBuilder;
|
|
2143
2548
|
queryContext(context: any): TableBuilder;
|
|
@@ -2176,11 +2581,18 @@ export declare namespace Knex {
|
|
|
2176
2581
|
|
|
2177
2582
|
interface ColumnBuilder {
|
|
2178
2583
|
index(indexName?: string): ColumnBuilder;
|
|
2179
|
-
primary(
|
|
2584
|
+
primary(
|
|
2585
|
+
options?: Readonly<{
|
|
2586
|
+
constraintName?: string;
|
|
2587
|
+
deferrable?: deferrableType;
|
|
2588
|
+
}>
|
|
2589
|
+
): ColumnBuilder;
|
|
2180
2590
|
/** @deprecated */
|
|
2181
2591
|
primary(constraintName?: string): ColumnBuilder;
|
|
2182
2592
|
|
|
2183
|
-
unique(
|
|
2593
|
+
unique(
|
|
2594
|
+
options?: Readonly<{ indexName?: string; deferrable?: deferrableType }>
|
|
2595
|
+
): ColumnBuilder;
|
|
2184
2596
|
/** @deprecated */
|
|
2185
2597
|
unique(indexName?: string): ColumnBuilder;
|
|
2186
2598
|
references(columnName: string): ReferencingColumnBuilder;
|
|
@@ -2189,7 +2601,9 @@ export declare namespace Knex {
|
|
|
2189
2601
|
notNullable(): ColumnBuilder;
|
|
2190
2602
|
nullable(): ColumnBuilder;
|
|
2191
2603
|
comment(value: string): ColumnBuilder;
|
|
2192
|
-
alter(
|
|
2604
|
+
alter(
|
|
2605
|
+
options?: Readonly<{ alterNullable?: boolean; alterType?: boolean }>
|
|
2606
|
+
): ColumnBuilder;
|
|
2193
2607
|
queryContext(context: any): ColumnBuilder;
|
|
2194
2608
|
after(columnName: string): ColumnBuilder;
|
|
2195
2609
|
first(): ColumnBuilder;
|
|
@@ -2197,8 +2611,15 @@ export declare namespace Knex {
|
|
|
2197
2611
|
checkNegative(constraintName?: string): ColumnBuilder;
|
|
2198
2612
|
checkIn(values: string[], constraintName?: string): ColumnBuilder;
|
|
2199
2613
|
checkNotIn(values: string[], constraintName?: string): ColumnBuilder;
|
|
2200
|
-
checkBetween(
|
|
2201
|
-
|
|
2614
|
+
checkBetween(
|
|
2615
|
+
values: any[] | any[][],
|
|
2616
|
+
constraintName?: string
|
|
2617
|
+
): ColumnBuilder;
|
|
2618
|
+
checkLength(
|
|
2619
|
+
operator: lengthOperator,
|
|
2620
|
+
length: number,
|
|
2621
|
+
constraintName?: string
|
|
2622
|
+
): ColumnBuilder;
|
|
2202
2623
|
checkRegex(regex: string, constraintName?: string): ColumnBuilder;
|
|
2203
2624
|
}
|
|
2204
2625
|
|
|
@@ -2213,7 +2634,7 @@ export declare namespace Knex {
|
|
|
2213
2634
|
interface PostgreSqlColumnBuilder extends ColumnBuilder {
|
|
2214
2635
|
index(
|
|
2215
2636
|
indexName?: string,
|
|
2216
|
-
options?: Readonly<{indexType?: string
|
|
2637
|
+
options?: Readonly<{ indexType?: string; predicate?: QueryBuilder }>
|
|
2217
2638
|
): ColumnBuilder;
|
|
2218
2639
|
index(indexName?: string, indexType?: string): ColumnBuilder;
|
|
2219
2640
|
}
|
|
@@ -2221,28 +2642,33 @@ export declare namespace Knex {
|
|
|
2221
2642
|
interface SqlLiteColumnBuilder extends ColumnBuilder {
|
|
2222
2643
|
index(
|
|
2223
2644
|
indexName?: string,
|
|
2224
|
-
options?: Readonly<{predicate?: QueryBuilder}>
|
|
2645
|
+
options?: Readonly<{ predicate?: QueryBuilder }>
|
|
2225
2646
|
): ColumnBuilder;
|
|
2226
2647
|
}
|
|
2227
2648
|
|
|
2228
2649
|
interface MsSqlColumnBuilder extends ColumnBuilder {
|
|
2229
2650
|
index(
|
|
2230
2651
|
indexName?: string,
|
|
2231
|
-
options?: Readonly<{predicate?: QueryBuilder}>
|
|
2652
|
+
options?: Readonly<{ predicate?: QueryBuilder }>
|
|
2232
2653
|
): ColumnBuilder;
|
|
2233
2654
|
}
|
|
2234
2655
|
|
|
2235
2656
|
interface MySqlColumnBuilder extends ColumnBuilder {
|
|
2236
2657
|
index(
|
|
2237
2658
|
indexName?: string,
|
|
2238
|
-
options?: Readonly<{
|
|
2659
|
+
options?: Readonly<{
|
|
2660
|
+
indexType?: string;
|
|
2661
|
+
storageEngineIndexType?: storageEngineIndexType;
|
|
2662
|
+
}>
|
|
2239
2663
|
): ColumnBuilder;
|
|
2240
2664
|
}
|
|
2241
2665
|
|
|
2242
2666
|
// patched ColumnBuilder methods to return ReferencingColumnBuilder with new methods
|
|
2243
2667
|
// relies on ColumnBuilder returning only ColumnBuilder
|
|
2244
2668
|
type ReferencingColumnBuilder = {
|
|
2245
|
-
[K in keyof ColumnBuilder]: (
|
|
2669
|
+
[K in keyof ColumnBuilder]: (
|
|
2670
|
+
...args: Parameters<ColumnBuilder[K]>
|
|
2671
|
+
) => ReferencingColumnBuilder;
|
|
2246
2672
|
} & {
|
|
2247
2673
|
inTable(tableName: string): ReferencingColumnBuilder;
|
|
2248
2674
|
deferrable(type: deferrableType): ReferencingColumnBuilder;
|
|
@@ -2273,6 +2699,7 @@ export declare namespace Knex {
|
|
|
2273
2699
|
debug?: boolean;
|
|
2274
2700
|
client?: string | typeof Client;
|
|
2275
2701
|
dialect?: string;
|
|
2702
|
+
jsonbSupport?: boolean;
|
|
2276
2703
|
version?: string;
|
|
2277
2704
|
connection?: string | StaticConnectionConfig | ConnectionConfigProvider;
|
|
2278
2705
|
pool?: PoolConfig;
|
|
@@ -2303,9 +2730,11 @@ export declare namespace Knex {
|
|
|
2303
2730
|
| Sqlite3ConnectionConfig
|
|
2304
2731
|
| SocketConnectionConfig;
|
|
2305
2732
|
|
|
2306
|
-
type ConnectionConfigProvider
|
|
2307
|
-
|
|
2308
|
-
|
|
2733
|
+
type ConnectionConfigProvider =
|
|
2734
|
+
| SyncConnectionConfigProvider
|
|
2735
|
+
| AsyncConnectionConfigProvider;
|
|
2736
|
+
type SyncConnectionConfigProvider = () => StaticConnectionConfig;
|
|
2737
|
+
type AsyncConnectionConfigProvider = () => Promise<StaticConnectionConfig>;
|
|
2309
2738
|
|
|
2310
2739
|
interface ConnectionConfig {
|
|
2311
2740
|
host: string;
|
|
@@ -2449,11 +2878,17 @@ export declare namespace Knex {
|
|
|
2449
2878
|
abortTransactionOnError?: boolean;
|
|
2450
2879
|
trustedConnection?: boolean;
|
|
2451
2880
|
enableArithAbort?: boolean;
|
|
2452
|
-
isolationLevel?:
|
|
2881
|
+
isolationLevel?:
|
|
2882
|
+
| 'READ_UNCOMMITTED'
|
|
2883
|
+
| 'READ_COMMITTED'
|
|
2884
|
+
| 'REPEATABLE_READ'
|
|
2885
|
+
| 'SERIALIZABLE'
|
|
2886
|
+
| 'SNAPSHOT';
|
|
2453
2887
|
maxRetriesOnTransientErrors?: number;
|
|
2454
2888
|
multiSubnetFailover?: boolean;
|
|
2455
2889
|
packetSize?: number;
|
|
2456
2890
|
trustServerCertificate?: boolean;
|
|
2891
|
+
mapBinding?: (value: any) => ({ value: any, type: any } | undefined);
|
|
2457
2892
|
}>;
|
|
2458
2893
|
pool?: Readonly<{
|
|
2459
2894
|
min?: number;
|
|
@@ -2537,11 +2972,13 @@ export declare namespace Knex {
|
|
|
2537
2972
|
// Config object for mysql2: https://github.com/sidorares/node-mysql2/blob/master/lib/connection_config.js
|
|
2538
2973
|
// Some options for connection pooling and MySQL server API are excluded.
|
|
2539
2974
|
interface MySql2ConnectionConfig extends MySqlConnectionConfig {
|
|
2540
|
-
authPlugins?: {
|
|
2975
|
+
authPlugins?: {
|
|
2976
|
+
[pluginName: string]: (pluginMetadata: any) => (pluginData: any) => any;
|
|
2977
|
+
};
|
|
2541
2978
|
authSwitchHandler?: (data: any, callback: () => void) => any;
|
|
2542
2979
|
charsetNumber?: number;
|
|
2543
2980
|
compress?: boolean;
|
|
2544
|
-
connectAttributes?: {[attrNames: string]: any};
|
|
2981
|
+
connectAttributes?: { [attrNames: string]: any };
|
|
2545
2982
|
enableKeepAlive?: boolean;
|
|
2546
2983
|
keepAliveInitialDelay?: number;
|
|
2547
2984
|
maxPreparedStatements?: number;
|
|
@@ -2570,17 +3007,28 @@ export declare namespace Knex {
|
|
|
2570
3007
|
interface PgConnectionConfig {
|
|
2571
3008
|
user?: string;
|
|
2572
3009
|
database?: string;
|
|
2573
|
-
password?: string;
|
|
3010
|
+
password?: string | (() => string | Promise<string>);
|
|
2574
3011
|
port?: number;
|
|
2575
3012
|
host?: string;
|
|
2576
3013
|
connectionString?: string;
|
|
2577
3014
|
keepAlive?: boolean;
|
|
2578
3015
|
stream?: stream.Duplex;
|
|
2579
3016
|
statement_timeout?: false | number;
|
|
2580
|
-
|
|
2581
|
-
keepAliveInitialDelayMillis?: number;
|
|
3017
|
+
parseInputDatesAsUTC?: boolean;
|
|
2582
3018
|
ssl?: boolean | ConnectionOptions;
|
|
3019
|
+
query_timeout?: number;
|
|
3020
|
+
keepAliveInitialDelayMillis?: number;
|
|
3021
|
+
idle_in_transaction_session_timeout?: number;
|
|
2583
3022
|
application_name?: string;
|
|
3023
|
+
connectionTimeoutMillis?: number;
|
|
3024
|
+
types?: PgCustomTypesConfig;
|
|
3025
|
+
options?: string;
|
|
3026
|
+
}
|
|
3027
|
+
|
|
3028
|
+
type PgGetTypeParser = (oid: number, format: string) => any;
|
|
3029
|
+
|
|
3030
|
+
interface PgCustomTypesConfig {
|
|
3031
|
+
getTypeParser: PgGetTypeParser;
|
|
2584
3032
|
}
|
|
2585
3033
|
|
|
2586
3034
|
type RedshiftConnectionConfig = PgConnectionConfig;
|
|
@@ -2635,7 +3083,7 @@ export declare namespace Knex {
|
|
|
2635
3083
|
|
|
2636
3084
|
interface Migration {
|
|
2637
3085
|
up: (knex: Knex) => PromiseLike<any>;
|
|
2638
|
-
down?: (
|
|
3086
|
+
down?: (knex: Knex) => PromiseLike<any>;
|
|
2639
3087
|
}
|
|
2640
3088
|
|
|
2641
3089
|
interface MigrationSource<TMigrationSpec> {
|
|
@@ -2738,7 +3186,12 @@ export declare namespace Knex {
|
|
|
2738
3186
|
queryCompiler(builder: any): any;
|
|
2739
3187
|
schemaBuilder(): SchemaBuilder;
|
|
2740
3188
|
schemaCompiler(builder: SchemaBuilder): any;
|
|
2741
|
-
tableBuilder(
|
|
3189
|
+
tableBuilder(
|
|
3190
|
+
type: any,
|
|
3191
|
+
tableName: any,
|
|
3192
|
+
tableNameLike: any,
|
|
3193
|
+
fn: any
|
|
3194
|
+
): TableBuilder;
|
|
2742
3195
|
tableCompiler(tableBuilder: any): any;
|
|
2743
3196
|
columnBuilder(tableBuilder: any, type: any, args: any): ColumnBuilder;
|
|
2744
3197
|
columnCompiler(tableBuilder: any, columnBuilder: any): any;
|