kysely 0.28.14 → 0.28.16
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/README.md +1 -0
- package/dist/cjs/dialect/postgres/postgres-introspector.js +21 -19
- package/dist/cjs/expression/expression-builder.d.ts +1 -1
- package/dist/cjs/index.d.ts +4 -0
- package/dist/cjs/index.js +4 -0
- package/dist/cjs/migration/file-migration-provider.js +34 -1
- package/dist/cjs/parser/binary-operation-parser.d.ts +3 -1
- package/dist/cjs/query-builder/delete-query-builder.d.ts +4 -4
- package/dist/cjs/query-builder/delete-query-builder.js +24 -22
- package/dist/cjs/query-builder/select-query-builder.js +43 -41
- package/dist/cjs/query-builder/update-query-builder.d.ts +4 -4
- package/dist/cjs/query-builder/update-query-builder.js +24 -22
- package/dist/cjs/util/column-type.d.ts +54 -0
- package/dist/cjs/util/type-utils.d.ts +1 -1
- package/dist/esm/dialect/postgres/postgres-introspector.js +21 -19
- package/dist/esm/expression/expression-builder.d.ts +1 -1
- package/dist/esm/index.d.ts +4 -0
- package/dist/esm/index.js +4 -0
- package/dist/esm/parser/binary-operation-parser.d.ts +3 -1
- package/dist/esm/query-builder/delete-query-builder.d.ts +4 -4
- package/dist/esm/query-builder/delete-query-builder.js +24 -22
- package/dist/esm/query-builder/select-query-builder.js +43 -41
- package/dist/esm/query-builder/update-query-builder.d.ts +4 -4
- package/dist/esm/query-builder/update-query-builder.js +24 -22
- package/dist/esm/util/column-type.d.ts +54 -0
- package/dist/esm/util/type-utils.d.ts +1 -1
- package/package.json +41 -40
|
@@ -6,12 +6,14 @@ import { type ValueExpression, type ValueExpressionOrList } from './value-parser
|
|
|
6
6
|
import type { OperationNode } from '../operation-node/operation-node.js';
|
|
7
7
|
import type { Expression } from '../expression/expression.js';
|
|
8
8
|
import type { SelectType } from '../util/column-type.js';
|
|
9
|
+
import type { IsNever } from '../util/type-utils.js';
|
|
10
|
+
import type { KyselyTypeError } from '../util/type-error.js';
|
|
9
11
|
export type OperandValueExpression<DB, TB extends keyof DB, RE> = ValueExpression<DB, TB, ExtractTypeFromReferenceExpression<DB, TB, RE>>;
|
|
10
12
|
export type OperandValueExpressionOrList<DB, TB extends keyof DB, RE> = ValueExpressionOrList<DB, TB, ExtractTypeFromReferenceExpression<DB, TB, RE> | null>;
|
|
11
13
|
export type OperatorExpression = Operator | Expression<unknown>;
|
|
12
14
|
export type BinaryOperatorExpression = BinaryOperator | Expression<unknown>;
|
|
13
15
|
export type ComparisonOperatorExpression = ComparisonOperator | Expression<unknown>;
|
|
14
|
-
export type FilterObject<DB, TB extends keyof DB> = {
|
|
16
|
+
export type FilterObject<DB, TB extends keyof DB> = IsNever<TB> extends true ? KyselyTypeError<'there are no tables in query context, so a filter object cannot be defined. try passing an array instead.'> : {
|
|
15
17
|
[R in StringReference<DB, TB>]?: ValueExpressionOrList<DB, TB, SelectType<ExtractTypeFromStringReference<DB, TB, R>>>;
|
|
16
18
|
};
|
|
17
19
|
export declare function parseValueBinaryOperationOrExpression(args: any[]): OperationNode;
|
|
@@ -976,21 +976,21 @@ export declare class DeleteQueryBuilder<DB, TB extends keyof DB, O> implements W
|
|
|
976
976
|
*/
|
|
977
977
|
clearLimit(): DeleteQueryBuilder<DB, TB, O>;
|
|
978
978
|
/**
|
|
979
|
-
* @
|
|
979
|
+
* @remarks This is only supported by some dialects like MySQL or SQLite with `SQLITE_ENABLE_UPDATE_DELETE_LIMIT`.
|
|
980
980
|
*/
|
|
981
981
|
orderBy<OE extends OrderByExpression<DB, TB, {}>>(expr: OE, modifiers?: OrderByModifiers): DeleteQueryBuilder<DB, TB, O>;
|
|
982
982
|
/**
|
|
983
|
-
* @
|
|
983
|
+
* @remarks This is only supported by some dialects like MySQL or SQLite with `SQLITE_ENABLE_UPDATE_DELETE_LIMIT`.
|
|
984
984
|
* @deprecated It does ~2-2.6x more compile-time instantiations compared to multiple chained `orderBy(expr, modifiers?)` calls (in `order by` clauses with reasonable item counts), and has broken autocompletion.
|
|
985
985
|
*/
|
|
986
986
|
orderBy<OE extends OrderByExpression<DB, TB, {}> | DirectedOrderByStringReference<DB, TB, {}>>(exprs: ReadonlyArray<OE>): DeleteQueryBuilder<DB, TB, O>;
|
|
987
987
|
/**
|
|
988
|
-
* @
|
|
988
|
+
* @remarks This is only supported by some dialects like MySQL or SQLite with `SQLITE_ENABLE_UPDATE_DELETE_LIMIT`.
|
|
989
989
|
* @deprecated It does ~2.9x more compile-time instantiations compared to a `orderBy(expr, direction)` call.
|
|
990
990
|
*/
|
|
991
991
|
orderBy<OE extends DirectedOrderByStringReference<DB, TB, {}>>(expr: OE): DeleteQueryBuilder<DB, TB, O>;
|
|
992
992
|
/**
|
|
993
|
-
* @
|
|
993
|
+
* @remarks This is only supported by some dialects like MySQL or SQLite with `SQLITE_ENABLE_UPDATE_DELETE_LIMIT`.
|
|
994
994
|
* @deprecated Use `orderBy(expr, (ob) => ...)` instead.
|
|
995
995
|
*/
|
|
996
996
|
orderBy<OE extends OrderByExpression<DB, TB, {}>>(expr: OE, modifiers: Expression<any>): DeleteQueryBuilder<DB, TB, O>;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="./delete-query-builder.d.ts" />
|
|
2
|
+
var _a;
|
|
2
3
|
import { parseJoin, } from '../parser/join-parser.js';
|
|
3
4
|
import { parseTableExpressionOrList, } from '../parser/table-parser.js';
|
|
4
5
|
import { parseSelectArg, parseSelectAll, } from '../parser/select-parser.js';
|
|
@@ -18,19 +19,19 @@ export class DeleteQueryBuilder {
|
|
|
18
19
|
this.#props = freeze(props);
|
|
19
20
|
}
|
|
20
21
|
where(...args) {
|
|
21
|
-
return new
|
|
22
|
+
return new _a({
|
|
22
23
|
...this.#props,
|
|
23
24
|
queryNode: QueryNode.cloneWithWhere(this.#props.queryNode, parseValueBinaryOperationOrExpression(args)),
|
|
24
25
|
});
|
|
25
26
|
}
|
|
26
27
|
whereRef(lhs, op, rhs) {
|
|
27
|
-
return new
|
|
28
|
+
return new _a({
|
|
28
29
|
...this.#props,
|
|
29
30
|
queryNode: QueryNode.cloneWithWhere(this.#props.queryNode, parseReferentialBinaryOperation(lhs, op, rhs)),
|
|
30
31
|
});
|
|
31
32
|
}
|
|
32
33
|
clearWhere() {
|
|
33
|
-
return new
|
|
34
|
+
return new _a({
|
|
34
35
|
...this.#props,
|
|
35
36
|
queryNode: QueryNode.cloneWithoutWhere(this.#props.queryNode),
|
|
36
37
|
});
|
|
@@ -75,13 +76,13 @@ export class DeleteQueryBuilder {
|
|
|
75
76
|
* ```
|
|
76
77
|
*/
|
|
77
78
|
top(expression, modifiers) {
|
|
78
|
-
return new
|
|
79
|
+
return new _a({
|
|
79
80
|
...this.#props,
|
|
80
81
|
queryNode: QueryNode.cloneWithTop(this.#props.queryNode, parseTop(expression, modifiers)),
|
|
81
82
|
});
|
|
82
83
|
}
|
|
83
84
|
using(tables) {
|
|
84
|
-
return new
|
|
85
|
+
return new _a({
|
|
85
86
|
...this.#props,
|
|
86
87
|
queryNode: DeleteQueryNode.cloneWithUsing(this.#props.queryNode, parseTableExpressionOrList(tables)),
|
|
87
88
|
});
|
|
@@ -99,31 +100,31 @@ export class DeleteQueryBuilder {
|
|
|
99
100
|
return this.#join('FullJoin', args);
|
|
100
101
|
}
|
|
101
102
|
#join(joinType, args) {
|
|
102
|
-
return new
|
|
103
|
+
return new _a({
|
|
103
104
|
...this.#props,
|
|
104
105
|
queryNode: QueryNode.cloneWithJoin(this.#props.queryNode, parseJoin(joinType, args)),
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
108
|
returning(selection) {
|
|
108
|
-
return new
|
|
109
|
+
return new _a({
|
|
109
110
|
...this.#props,
|
|
110
111
|
queryNode: QueryNode.cloneWithReturning(this.#props.queryNode, parseSelectArg(selection)),
|
|
111
112
|
});
|
|
112
113
|
}
|
|
113
114
|
returningAll(table) {
|
|
114
|
-
return new
|
|
115
|
+
return new _a({
|
|
115
116
|
...this.#props,
|
|
116
117
|
queryNode: QueryNode.cloneWithReturning(this.#props.queryNode, parseSelectAll(table)),
|
|
117
118
|
});
|
|
118
119
|
}
|
|
119
120
|
output(args) {
|
|
120
|
-
return new
|
|
121
|
+
return new _a({
|
|
121
122
|
...this.#props,
|
|
122
123
|
queryNode: QueryNode.cloneWithOutput(this.#props.queryNode, parseSelectArg(args)),
|
|
123
124
|
});
|
|
124
125
|
}
|
|
125
126
|
outputAll(table) {
|
|
126
|
-
return new
|
|
127
|
+
return new _a({
|
|
127
128
|
...this.#props,
|
|
128
129
|
queryNode: QueryNode.cloneWithOutput(this.#props.queryNode, parseSelectAll(table)),
|
|
129
130
|
});
|
|
@@ -148,7 +149,7 @@ export class DeleteQueryBuilder {
|
|
|
148
149
|
* ```
|
|
149
150
|
*/
|
|
150
151
|
clearReturning() {
|
|
151
|
-
return new
|
|
152
|
+
return new _a({
|
|
152
153
|
...this.#props,
|
|
153
154
|
queryNode: QueryNode.cloneWithoutReturning(this.#props.queryNode),
|
|
154
155
|
});
|
|
@@ -174,19 +175,19 @@ export class DeleteQueryBuilder {
|
|
|
174
175
|
* ```
|
|
175
176
|
*/
|
|
176
177
|
clearLimit() {
|
|
177
|
-
return new
|
|
178
|
+
return new _a({
|
|
178
179
|
...this.#props,
|
|
179
180
|
queryNode: DeleteQueryNode.cloneWithoutLimit(this.#props.queryNode),
|
|
180
181
|
});
|
|
181
182
|
}
|
|
182
183
|
orderBy(...args) {
|
|
183
|
-
return new
|
|
184
|
+
return new _a({
|
|
184
185
|
...this.#props,
|
|
185
186
|
queryNode: QueryNode.cloneWithOrderByItems(this.#props.queryNode, parseOrderBy(args)),
|
|
186
187
|
});
|
|
187
188
|
}
|
|
188
189
|
clearOrderBy() {
|
|
189
|
-
return new
|
|
190
|
+
return new _a({
|
|
190
191
|
...this.#props,
|
|
191
192
|
queryNode: QueryNode.cloneWithoutOrderBy(this.#props.queryNode),
|
|
192
193
|
});
|
|
@@ -216,7 +217,7 @@ export class DeleteQueryBuilder {
|
|
|
216
217
|
* ```
|
|
217
218
|
*/
|
|
218
219
|
limit(limit) {
|
|
219
|
-
return new
|
|
220
|
+
return new _a({
|
|
220
221
|
...this.#props,
|
|
221
222
|
queryNode: DeleteQueryNode.cloneWithLimit(this.#props.queryNode, LimitNode.create(parseValueExpression(limit))),
|
|
222
223
|
});
|
|
@@ -243,7 +244,7 @@ export class DeleteQueryBuilder {
|
|
|
243
244
|
* ```
|
|
244
245
|
*/
|
|
245
246
|
modifyEnd(modifier) {
|
|
246
|
-
return new
|
|
247
|
+
return new _a({
|
|
247
248
|
...this.#props,
|
|
248
249
|
queryNode: QueryNode.cloneWithEndModifier(this.#props.queryNode, modifier.toOperationNode()),
|
|
249
250
|
});
|
|
@@ -314,7 +315,7 @@ export class DeleteQueryBuilder {
|
|
|
314
315
|
if (condition) {
|
|
315
316
|
return func(this);
|
|
316
317
|
}
|
|
317
|
-
return new
|
|
318
|
+
return new _a({
|
|
318
319
|
...this.#props,
|
|
319
320
|
});
|
|
320
321
|
}
|
|
@@ -325,7 +326,7 @@ export class DeleteQueryBuilder {
|
|
|
325
326
|
* returns a copy of this `DeleteQueryBuilder` with a new output type.
|
|
326
327
|
*/
|
|
327
328
|
$castTo() {
|
|
328
|
-
return new
|
|
329
|
+
return new _a(this.#props);
|
|
329
330
|
}
|
|
330
331
|
/**
|
|
331
332
|
* Narrows (parts of) the output type of the query.
|
|
@@ -377,7 +378,7 @@ export class DeleteQueryBuilder {
|
|
|
377
378
|
* ```
|
|
378
379
|
*/
|
|
379
380
|
$narrowType() {
|
|
380
|
-
return new
|
|
381
|
+
return new _a(this.#props);
|
|
381
382
|
}
|
|
382
383
|
/**
|
|
383
384
|
* Asserts that query's output row type equals the given type `T`.
|
|
@@ -425,13 +426,13 @@ export class DeleteQueryBuilder {
|
|
|
425
426
|
* ```
|
|
426
427
|
*/
|
|
427
428
|
$assertType() {
|
|
428
|
-
return new
|
|
429
|
+
return new _a(this.#props);
|
|
429
430
|
}
|
|
430
431
|
/**
|
|
431
432
|
* Returns a copy of this DeleteQueryBuilder instance with the given plugin installed.
|
|
432
433
|
*/
|
|
433
434
|
withPlugin(plugin) {
|
|
434
|
-
return new
|
|
435
|
+
return new _a({
|
|
435
436
|
...this.#props,
|
|
436
437
|
executor: this.#props.executor.withPlugin(plugin),
|
|
437
438
|
});
|
|
@@ -492,10 +493,11 @@ export class DeleteQueryBuilder {
|
|
|
492
493
|
}
|
|
493
494
|
}
|
|
494
495
|
async explain(format, options) {
|
|
495
|
-
const builder = new
|
|
496
|
+
const builder = new _a({
|
|
496
497
|
...this.#props,
|
|
497
498
|
queryNode: QueryNode.cloneWithExplain(this.#props.queryNode, format, options),
|
|
498
499
|
});
|
|
499
500
|
return await builder.execute();
|
|
500
501
|
}
|
|
501
502
|
}
|
|
503
|
+
_a = DeleteQueryBuilder;
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="./select-query-builder.d.ts" />
|
|
2
|
+
var _a;
|
|
2
3
|
import { AliasNode } from '../operation-node/alias-node.js';
|
|
3
4
|
import { SelectModifierNode } from '../operation-node/select-modifier-node.js';
|
|
4
5
|
import { parseJoin, } from '../parser/join-parser.js';
|
|
@@ -32,97 +33,97 @@ class SelectQueryBuilderImpl {
|
|
|
32
33
|
return true;
|
|
33
34
|
}
|
|
34
35
|
where(...args) {
|
|
35
|
-
return new
|
|
36
|
+
return new _a({
|
|
36
37
|
...this.#props,
|
|
37
38
|
queryNode: QueryNode.cloneWithWhere(this.#props.queryNode, parseValueBinaryOperationOrExpression(args)),
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
whereRef(lhs, op, rhs) {
|
|
41
|
-
return new
|
|
42
|
+
return new _a({
|
|
42
43
|
...this.#props,
|
|
43
44
|
queryNode: QueryNode.cloneWithWhere(this.#props.queryNode, parseReferentialBinaryOperation(lhs, op, rhs)),
|
|
44
45
|
});
|
|
45
46
|
}
|
|
46
47
|
having(...args) {
|
|
47
|
-
return new
|
|
48
|
+
return new _a({
|
|
48
49
|
...this.#props,
|
|
49
50
|
queryNode: SelectQueryNode.cloneWithHaving(this.#props.queryNode, parseValueBinaryOperationOrExpression(args)),
|
|
50
51
|
});
|
|
51
52
|
}
|
|
52
53
|
havingRef(lhs, op, rhs) {
|
|
53
|
-
return new
|
|
54
|
+
return new _a({
|
|
54
55
|
...this.#props,
|
|
55
56
|
queryNode: SelectQueryNode.cloneWithHaving(this.#props.queryNode, parseReferentialBinaryOperation(lhs, op, rhs)),
|
|
56
57
|
});
|
|
57
58
|
}
|
|
58
59
|
select(selection) {
|
|
59
|
-
return new
|
|
60
|
+
return new _a({
|
|
60
61
|
...this.#props,
|
|
61
62
|
queryNode: SelectQueryNode.cloneWithSelections(this.#props.queryNode, parseSelectArg(selection)),
|
|
62
63
|
});
|
|
63
64
|
}
|
|
64
65
|
distinctOn(selection) {
|
|
65
|
-
return new
|
|
66
|
+
return new _a({
|
|
66
67
|
...this.#props,
|
|
67
68
|
queryNode: SelectQueryNode.cloneWithDistinctOn(this.#props.queryNode, parseReferenceExpressionOrList(selection)),
|
|
68
69
|
});
|
|
69
70
|
}
|
|
70
71
|
modifyFront(modifier) {
|
|
71
|
-
return new
|
|
72
|
+
return new _a({
|
|
72
73
|
...this.#props,
|
|
73
74
|
queryNode: SelectQueryNode.cloneWithFrontModifier(this.#props.queryNode, SelectModifierNode.createWithExpression(modifier.toOperationNode())),
|
|
74
75
|
});
|
|
75
76
|
}
|
|
76
77
|
modifyEnd(modifier) {
|
|
77
|
-
return new
|
|
78
|
+
return new _a({
|
|
78
79
|
...this.#props,
|
|
79
80
|
queryNode: QueryNode.cloneWithEndModifier(this.#props.queryNode, SelectModifierNode.createWithExpression(modifier.toOperationNode())),
|
|
80
81
|
});
|
|
81
82
|
}
|
|
82
83
|
distinct() {
|
|
83
|
-
return new
|
|
84
|
+
return new _a({
|
|
84
85
|
...this.#props,
|
|
85
86
|
queryNode: SelectQueryNode.cloneWithFrontModifier(this.#props.queryNode, SelectModifierNode.create('Distinct')),
|
|
86
87
|
});
|
|
87
88
|
}
|
|
88
89
|
forUpdate(of) {
|
|
89
|
-
return new
|
|
90
|
+
return new _a({
|
|
90
91
|
...this.#props,
|
|
91
92
|
queryNode: QueryNode.cloneWithEndModifier(this.#props.queryNode, SelectModifierNode.create('ForUpdate', of ? asArray(of).map(parseTable) : undefined)),
|
|
92
93
|
});
|
|
93
94
|
}
|
|
94
95
|
forShare(of) {
|
|
95
|
-
return new
|
|
96
|
+
return new _a({
|
|
96
97
|
...this.#props,
|
|
97
98
|
queryNode: QueryNode.cloneWithEndModifier(this.#props.queryNode, SelectModifierNode.create('ForShare', of ? asArray(of).map(parseTable) : undefined)),
|
|
98
99
|
});
|
|
99
100
|
}
|
|
100
101
|
forKeyShare(of) {
|
|
101
|
-
return new
|
|
102
|
+
return new _a({
|
|
102
103
|
...this.#props,
|
|
103
104
|
queryNode: QueryNode.cloneWithEndModifier(this.#props.queryNode, SelectModifierNode.create('ForKeyShare', of ? asArray(of).map(parseTable) : undefined)),
|
|
104
105
|
});
|
|
105
106
|
}
|
|
106
107
|
forNoKeyUpdate(of) {
|
|
107
|
-
return new
|
|
108
|
+
return new _a({
|
|
108
109
|
...this.#props,
|
|
109
110
|
queryNode: QueryNode.cloneWithEndModifier(this.#props.queryNode, SelectModifierNode.create('ForNoKeyUpdate', of ? asArray(of).map(parseTable) : undefined)),
|
|
110
111
|
});
|
|
111
112
|
}
|
|
112
113
|
skipLocked() {
|
|
113
|
-
return new
|
|
114
|
+
return new _a({
|
|
114
115
|
...this.#props,
|
|
115
116
|
queryNode: QueryNode.cloneWithEndModifier(this.#props.queryNode, SelectModifierNode.create('SkipLocked')),
|
|
116
117
|
});
|
|
117
118
|
}
|
|
118
119
|
noWait() {
|
|
119
|
-
return new
|
|
120
|
+
return new _a({
|
|
120
121
|
...this.#props,
|
|
121
122
|
queryNode: QueryNode.cloneWithEndModifier(this.#props.queryNode, SelectModifierNode.create('NoWait')),
|
|
122
123
|
});
|
|
123
124
|
}
|
|
124
125
|
selectAll(table) {
|
|
125
|
-
return new
|
|
126
|
+
return new _a({
|
|
126
127
|
...this.#props,
|
|
127
128
|
queryNode: SelectQueryNode.cloneWithSelections(this.#props.queryNode, parseSelectAll(table)),
|
|
128
129
|
});
|
|
@@ -158,79 +159,79 @@ class SelectQueryBuilderImpl {
|
|
|
158
159
|
return this.#join('OuterApply', args);
|
|
159
160
|
}
|
|
160
161
|
#join(joinType, args) {
|
|
161
|
-
return new
|
|
162
|
+
return new _a({
|
|
162
163
|
...this.#props,
|
|
163
164
|
queryNode: QueryNode.cloneWithJoin(this.#props.queryNode, parseJoin(joinType, args)),
|
|
164
165
|
});
|
|
165
166
|
}
|
|
166
167
|
orderBy(...args) {
|
|
167
|
-
return new
|
|
168
|
+
return new _a({
|
|
168
169
|
...this.#props,
|
|
169
170
|
queryNode: QueryNode.cloneWithOrderByItems(this.#props.queryNode, parseOrderBy(args)),
|
|
170
171
|
});
|
|
171
172
|
}
|
|
172
173
|
groupBy(groupBy) {
|
|
173
|
-
return new
|
|
174
|
+
return new _a({
|
|
174
175
|
...this.#props,
|
|
175
176
|
queryNode: SelectQueryNode.cloneWithGroupByItems(this.#props.queryNode, parseGroupBy(groupBy)),
|
|
176
177
|
});
|
|
177
178
|
}
|
|
178
179
|
limit(limit) {
|
|
179
|
-
return new
|
|
180
|
+
return new _a({
|
|
180
181
|
...this.#props,
|
|
181
182
|
queryNode: SelectQueryNode.cloneWithLimit(this.#props.queryNode, LimitNode.create(parseValueExpression(limit))),
|
|
182
183
|
});
|
|
183
184
|
}
|
|
184
185
|
offset(offset) {
|
|
185
|
-
return new
|
|
186
|
+
return new _a({
|
|
186
187
|
...this.#props,
|
|
187
188
|
queryNode: SelectQueryNode.cloneWithOffset(this.#props.queryNode, OffsetNode.create(parseValueExpression(offset))),
|
|
188
189
|
});
|
|
189
190
|
}
|
|
190
191
|
fetch(rowCount, modifier = 'only') {
|
|
191
|
-
return new
|
|
192
|
+
return new _a({
|
|
192
193
|
...this.#props,
|
|
193
194
|
queryNode: SelectQueryNode.cloneWithFetch(this.#props.queryNode, parseFetch(rowCount, modifier)),
|
|
194
195
|
});
|
|
195
196
|
}
|
|
196
197
|
top(expression, modifiers) {
|
|
197
|
-
return new
|
|
198
|
+
return new _a({
|
|
198
199
|
...this.#props,
|
|
199
200
|
queryNode: QueryNode.cloneWithTop(this.#props.queryNode, parseTop(expression, modifiers)),
|
|
200
201
|
});
|
|
201
202
|
}
|
|
202
203
|
union(expression) {
|
|
203
|
-
return new
|
|
204
|
+
return new _a({
|
|
204
205
|
...this.#props,
|
|
205
206
|
queryNode: SelectQueryNode.cloneWithSetOperations(this.#props.queryNode, parseSetOperations('union', expression, false)),
|
|
206
207
|
});
|
|
207
208
|
}
|
|
208
209
|
unionAll(expression) {
|
|
209
|
-
return new
|
|
210
|
+
return new _a({
|
|
210
211
|
...this.#props,
|
|
211
212
|
queryNode: SelectQueryNode.cloneWithSetOperations(this.#props.queryNode, parseSetOperations('union', expression, true)),
|
|
212
213
|
});
|
|
213
214
|
}
|
|
214
215
|
intersect(expression) {
|
|
215
|
-
return new
|
|
216
|
+
return new _a({
|
|
216
217
|
...this.#props,
|
|
217
218
|
queryNode: SelectQueryNode.cloneWithSetOperations(this.#props.queryNode, parseSetOperations('intersect', expression, false)),
|
|
218
219
|
});
|
|
219
220
|
}
|
|
220
221
|
intersectAll(expression) {
|
|
221
|
-
return new
|
|
222
|
+
return new _a({
|
|
222
223
|
...this.#props,
|
|
223
224
|
queryNode: SelectQueryNode.cloneWithSetOperations(this.#props.queryNode, parseSetOperations('intersect', expression, true)),
|
|
224
225
|
});
|
|
225
226
|
}
|
|
226
227
|
except(expression) {
|
|
227
|
-
return new
|
|
228
|
+
return new _a({
|
|
228
229
|
...this.#props,
|
|
229
230
|
queryNode: SelectQueryNode.cloneWithSetOperations(this.#props.queryNode, parseSetOperations('except', expression, false)),
|
|
230
231
|
});
|
|
231
232
|
}
|
|
232
233
|
exceptAll(expression) {
|
|
233
|
-
return new
|
|
234
|
+
return new _a({
|
|
234
235
|
...this.#props,
|
|
235
236
|
queryNode: SelectQueryNode.cloneWithSetOperations(this.#props.queryNode, parseSetOperations('except', expression, true)),
|
|
236
237
|
});
|
|
@@ -239,37 +240,37 @@ class SelectQueryBuilderImpl {
|
|
|
239
240
|
return new AliasedSelectQueryBuilderImpl(this, alias);
|
|
240
241
|
}
|
|
241
242
|
clearSelect() {
|
|
242
|
-
return new
|
|
243
|
+
return new _a({
|
|
243
244
|
...this.#props,
|
|
244
245
|
queryNode: SelectQueryNode.cloneWithoutSelections(this.#props.queryNode),
|
|
245
246
|
});
|
|
246
247
|
}
|
|
247
248
|
clearWhere() {
|
|
248
|
-
return new
|
|
249
|
+
return new _a({
|
|
249
250
|
...this.#props,
|
|
250
251
|
queryNode: QueryNode.cloneWithoutWhere(this.#props.queryNode),
|
|
251
252
|
});
|
|
252
253
|
}
|
|
253
254
|
clearLimit() {
|
|
254
|
-
return new
|
|
255
|
+
return new _a({
|
|
255
256
|
...this.#props,
|
|
256
257
|
queryNode: SelectQueryNode.cloneWithoutLimit(this.#props.queryNode),
|
|
257
258
|
});
|
|
258
259
|
}
|
|
259
260
|
clearOffset() {
|
|
260
|
-
return new
|
|
261
|
+
return new _a({
|
|
261
262
|
...this.#props,
|
|
262
263
|
queryNode: SelectQueryNode.cloneWithoutOffset(this.#props.queryNode),
|
|
263
264
|
});
|
|
264
265
|
}
|
|
265
266
|
clearOrderBy() {
|
|
266
|
-
return new
|
|
267
|
+
return new _a({
|
|
267
268
|
...this.#props,
|
|
268
269
|
queryNode: QueryNode.cloneWithoutOrderBy(this.#props.queryNode),
|
|
269
270
|
});
|
|
270
271
|
}
|
|
271
272
|
clearGroupBy() {
|
|
272
|
-
return new
|
|
273
|
+
return new _a({
|
|
273
274
|
...this.#props,
|
|
274
275
|
queryNode: SelectQueryNode.cloneWithoutGroupBy(this.#props.queryNode),
|
|
275
276
|
});
|
|
@@ -281,18 +282,18 @@ class SelectQueryBuilderImpl {
|
|
|
281
282
|
if (condition) {
|
|
282
283
|
return func(this);
|
|
283
284
|
}
|
|
284
|
-
return new
|
|
285
|
+
return new _a({
|
|
285
286
|
...this.#props,
|
|
286
287
|
});
|
|
287
288
|
}
|
|
288
289
|
$castTo() {
|
|
289
|
-
return new
|
|
290
|
+
return new _a(this.#props);
|
|
290
291
|
}
|
|
291
292
|
$narrowType() {
|
|
292
|
-
return new
|
|
293
|
+
return new _a(this.#props);
|
|
293
294
|
}
|
|
294
295
|
$assertType() {
|
|
295
|
-
return new
|
|
296
|
+
return new _a(this.#props);
|
|
296
297
|
}
|
|
297
298
|
$asTuple() {
|
|
298
299
|
return new ExpressionWrapper(this.toOperationNode());
|
|
@@ -301,7 +302,7 @@ class SelectQueryBuilderImpl {
|
|
|
301
302
|
return new ExpressionWrapper(this.toOperationNode());
|
|
302
303
|
}
|
|
303
304
|
withPlugin(plugin) {
|
|
304
|
-
return new
|
|
305
|
+
return new _a({
|
|
305
306
|
...this.#props,
|
|
306
307
|
executor: this.#props.executor.withPlugin(plugin),
|
|
307
308
|
});
|
|
@@ -339,13 +340,14 @@ class SelectQueryBuilderImpl {
|
|
|
339
340
|
}
|
|
340
341
|
}
|
|
341
342
|
async explain(format, options) {
|
|
342
|
-
const builder = new
|
|
343
|
+
const builder = new _a({
|
|
343
344
|
...this.#props,
|
|
344
345
|
queryNode: QueryNode.cloneWithExplain(this.#props.queryNode, format, options),
|
|
345
346
|
});
|
|
346
347
|
return await builder.execute();
|
|
347
348
|
}
|
|
348
349
|
}
|
|
350
|
+
_a = SelectQueryBuilderImpl;
|
|
349
351
|
export function createSelectQueryBuilder(props) {
|
|
350
352
|
return new SelectQueryBuilderImpl(props);
|
|
351
353
|
}
|
|
@@ -602,21 +602,21 @@ export declare class UpdateQueryBuilder<DB, UT extends keyof DB, TB extends keyo
|
|
|
602
602
|
fullJoin<TE extends TableExpression<DB, TB>, K1 extends JoinReferenceExpression<DB, TB, TE>, K2 extends JoinReferenceExpression<DB, TB, TE>>(table: TE, k1: K1, k2: K2): UpdateQueryBuilderWithFullJoin<DB, UT, TB, O, TE>;
|
|
603
603
|
fullJoin<TE extends TableExpression<DB, TB>, FN extends JoinCallbackExpression<DB, TB, TE>>(table: TE, callback: FN): UpdateQueryBuilderWithFullJoin<DB, UT, TB, O, TE>;
|
|
604
604
|
/**
|
|
605
|
-
* @
|
|
605
|
+
* @remarks This is only supported by some dialects like MySQL or SQLite with `SQLITE_ENABLE_UPDATE_DELETE_LIMIT`.
|
|
606
606
|
*/
|
|
607
607
|
orderBy<OE extends OrderByExpression<DB, TB, {}>>(expr: OE, modifiers?: OrderByModifiers): UpdateQueryBuilder<DB, UT, TB, O>;
|
|
608
608
|
/**
|
|
609
|
-
* @
|
|
609
|
+
* @remarks This is only supported by some dialects like MySQL or SQLite with `SQLITE_ENABLE_UPDATE_DELETE_LIMIT`.
|
|
610
610
|
* @deprecated It does ~2-2.6x more compile-time instantiations compared to multiple chained `orderBy(expr, modifiers?)` calls (in `order by` clauses with reasonable item counts), and has broken autocompletion.
|
|
611
611
|
*/
|
|
612
612
|
orderBy<OE extends OrderByExpression<DB, TB, {}> | DirectedOrderByStringReference<DB, TB, {}>>(exprs: ReadonlyArray<OE>): UpdateQueryBuilder<DB, UT, TB, O>;
|
|
613
613
|
/**
|
|
614
|
-
* @
|
|
614
|
+
* @remarks This is only supported by some dialects like MySQL or SQLite with `SQLITE_ENABLE_UPDATE_DELETE_LIMIT`.
|
|
615
615
|
* @deprecated It does ~2.9x more compile-time instantiations compared to a `orderBy(expr, direction)` call.
|
|
616
616
|
*/
|
|
617
617
|
orderBy<OE extends DirectedOrderByStringReference<DB, TB, {}>>(expr: OE): UpdateQueryBuilder<DB, UT, TB, O>;
|
|
618
618
|
/**
|
|
619
|
-
* @
|
|
619
|
+
* @remarks This is only supported by some dialects like MySQL or SQLite with `SQLITE_ENABLE_UPDATE_DELETE_LIMIT`.
|
|
620
620
|
* @deprecated Use `orderBy(expr, (ob) => ...)` instead.
|
|
621
621
|
*/
|
|
622
622
|
orderBy<OE extends OrderByExpression<DB, TB, {}>>(expr: OE, modifiers: Expression<any>): UpdateQueryBuilder<DB, UT, TB, O>;
|