kysely 0.23.0 → 0.23.2
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 +5 -0
- package/dist/cjs/operation-node/on-conflict-node.d.ts +2 -0
- package/dist/cjs/operation-node/on-conflict-node.js +12 -0
- package/dist/cjs/operation-node/query-node.d.ts +1 -0
- package/dist/cjs/operation-node/query-node.js +6 -0
- package/dist/cjs/operation-node/select-query-node.d.ts +4 -0
- package/dist/cjs/operation-node/select-query-node.js +24 -0
- package/dist/cjs/query-builder/delete-query-builder.d.ts +63 -1
- package/dist/cjs/query-builder/delete-query-builder.js +51 -1
- package/dist/cjs/query-builder/insert-query-builder.d.ts +44 -1
- package/dist/cjs/query-builder/insert-query-builder.js +45 -1
- package/dist/cjs/query-builder/on-conflict-builder.d.ts +38 -0
- package/dist/cjs/query-builder/on-conflict-builder.js +12 -0
- package/dist/cjs/query-builder/select-query-builder.d.ts +138 -1
- package/dist/cjs/query-builder/select-query-builder.js +146 -1
- package/dist/cjs/query-builder/update-query-builder.d.ts +65 -1
- package/dist/cjs/query-builder/update-query-builder.js +53 -1
- package/dist/cjs/query-builder/where-interface.d.ts +19 -0
- package/dist/cjs/schema/alter-table-add-foreign-key-constraint-builder.d.ts +23 -0
- package/dist/cjs/schema/alter-table-add-foreign-key-constraint-builder.js +38 -0
- package/dist/cjs/schema/alter-table-builder.d.ts +4 -36
- package/dist/cjs/schema/alter-table-builder.js +12 -104
- package/dist/cjs/schema/alter-table-drop-constraint-builder.d.ts +21 -0
- package/dist/cjs/schema/alter-table-drop-constraint-builder.js +54 -0
- package/dist/cjs/schema/alter-table-executor.d.ts +18 -0
- package/dist/cjs/schema/alter-table-executor.js +22 -0
- package/dist/cjs/schema/create-index-builder.d.ts +1 -1
- package/dist/cjs/schema/create-index-builder.js +7 -7
- package/dist/cjs/schema/create-schema-builder.d.ts +1 -1
- package/dist/cjs/schema/create-schema-builder.js +2 -2
- package/dist/cjs/schema/create-table-builder.d.ts +1 -1
- package/dist/cjs/schema/create-table-builder.js +11 -11
- package/dist/cjs/schema/create-type-builder.d.ts +1 -1
- package/dist/cjs/schema/create-type-builder.js +2 -2
- package/dist/cjs/schema/create-view-builder.d.ts +1 -1
- package/dist/cjs/schema/create-view-builder.js +7 -7
- package/dist/cjs/schema/drop-index-builder.d.ts +1 -1
- package/dist/cjs/schema/drop-index-builder.js +4 -4
- package/dist/cjs/schema/drop-schema-builder.d.ts +1 -1
- package/dist/cjs/schema/drop-schema-builder.js +3 -3
- package/dist/cjs/schema/drop-table-builder.d.ts +1 -1
- package/dist/cjs/schema/drop-table-builder.js +3 -3
- package/dist/cjs/schema/drop-type-builder.d.ts +1 -1
- package/dist/cjs/schema/drop-type-builder.js +2 -2
- package/dist/cjs/schema/drop-view-builder.d.ts +1 -1
- package/dist/cjs/schema/drop-view-builder.js +4 -4
- package/dist/cjs/schema/schema.js +10 -10
- package/dist/cjs/util/type-error.d.ts +3 -0
- package/dist/cjs/util/type-error.js +2 -0
- package/dist/esm/operation-node/on-conflict-node.d.ts +2 -0
- package/dist/esm/operation-node/on-conflict-node.js +12 -0
- package/dist/esm/operation-node/query-node.d.ts +1 -0
- package/dist/esm/operation-node/query-node.js +6 -0
- package/dist/esm/operation-node/select-query-node.d.ts +4 -0
- package/dist/esm/operation-node/select-query-node.js +24 -0
- package/dist/esm/query-builder/delete-query-builder.d.ts +63 -1
- package/dist/esm/query-builder/delete-query-builder.js +51 -1
- package/dist/esm/query-builder/insert-query-builder.d.ts +44 -1
- package/dist/esm/query-builder/insert-query-builder.js +45 -1
- package/dist/esm/query-builder/on-conflict-builder.d.ts +38 -0
- package/dist/esm/query-builder/on-conflict-builder.js +12 -0
- package/dist/esm/query-builder/select-query-builder.d.ts +138 -1
- package/dist/esm/query-builder/select-query-builder.js +146 -1
- package/dist/esm/query-builder/update-query-builder.d.ts +65 -1
- package/dist/esm/query-builder/update-query-builder.js +53 -1
- package/dist/esm/query-builder/where-interface.d.ts +19 -0
- package/dist/esm/schema/alter-table-add-foreign-key-constraint-builder.d.ts +23 -0
- package/dist/esm/schema/alter-table-add-foreign-key-constraint-builder.js +35 -0
- package/dist/esm/schema/alter-table-builder.d.ts +4 -36
- package/dist/esm/schema/alter-table-builder.js +5 -94
- package/dist/esm/schema/alter-table-drop-constraint-builder.d.ts +21 -0
- package/dist/esm/schema/alter-table-drop-constraint-builder.js +51 -0
- package/dist/esm/schema/alter-table-executor.d.ts +18 -0
- package/dist/esm/schema/alter-table-executor.js +19 -0
- package/dist/esm/schema/create-index-builder.d.ts +1 -1
- package/dist/esm/schema/create-index-builder.js +7 -7
- package/dist/esm/schema/create-schema-builder.d.ts +1 -1
- package/dist/esm/schema/create-schema-builder.js +2 -2
- package/dist/esm/schema/create-table-builder.d.ts +1 -1
- package/dist/esm/schema/create-table-builder.js +11 -11
- package/dist/esm/schema/create-type-builder.d.ts +1 -1
- package/dist/esm/schema/create-type-builder.js +2 -2
- package/dist/esm/schema/create-view-builder.d.ts +1 -1
- package/dist/esm/schema/create-view-builder.js +7 -7
- package/dist/esm/schema/drop-index-builder.d.ts +1 -1
- package/dist/esm/schema/drop-index-builder.js +4 -4
- package/dist/esm/schema/drop-schema-builder.d.ts +1 -1
- package/dist/esm/schema/drop-schema-builder.js +3 -3
- package/dist/esm/schema/drop-table-builder.d.ts +1 -1
- package/dist/esm/schema/drop-table-builder.js +3 -3
- package/dist/esm/schema/drop-type-builder.d.ts +1 -1
- package/dist/esm/schema/drop-type-builder.js +2 -2
- package/dist/esm/schema/drop-view-builder.d.ts +1 -1
- package/dist/esm/schema/drop-view-builder.js +4 -4
- package/dist/esm/schema/schema.js +10 -10
- package/dist/esm/util/type-error.d.ts +3 -0
- package/dist/esm/util/type-error.js +2 -0
- package/package.json +2 -2
|
@@ -11,7 +11,7 @@ import { preventAwait } from '../util/prevent-await.js';
|
|
|
11
11
|
import { ColumnDefinitionBuilder, } from './column-definition-builder.js';
|
|
12
12
|
import { ModifyColumnNode } from '../operation-node/modify-column-node.js';
|
|
13
13
|
import { parseDataTypeExpression, } from '../parser/data-type-parser.js';
|
|
14
|
-
import { ForeignKeyConstraintBuilder
|
|
14
|
+
import { ForeignKeyConstraintBuilder } from './foreign-key-constraint-builder.js';
|
|
15
15
|
import { AddConstraintNode } from '../operation-node/add-constraint-node.js';
|
|
16
16
|
import { UniqueConstraintNode } from '../operation-node/unique-constraint-node.js';
|
|
17
17
|
import { CheckConstraintNode } from '../operation-node/check-constraint-node.js';
|
|
@@ -20,6 +20,9 @@ import { ColumnNode } from '../operation-node/column-node.js';
|
|
|
20
20
|
import { parseTable } from '../parser/table-parser.js';
|
|
21
21
|
import { DropConstraintNode } from '../operation-node/drop-constraint-node.js';
|
|
22
22
|
import { AlterColumnBuilder, } from './alter-column-builder.js';
|
|
23
|
+
import { AlterTableExecutor } from './alter-table-executor.js';
|
|
24
|
+
import { AlterTableAddForeignKeyConstraintBuilder } from './alter-table-add-foreign-key-constraint-builder.js';
|
|
25
|
+
import { AlterTableDropConstraintBuilder } from './alter-table-drop-constraint-builder.js';
|
|
23
26
|
/**
|
|
24
27
|
* This builder can be used to create a `alter table` query.
|
|
25
28
|
*/
|
|
@@ -129,25 +132,10 @@ export class AlterTableBuilder {
|
|
|
129
132
|
return func(this);
|
|
130
133
|
}
|
|
131
134
|
}
|
|
132
|
-
export class AlterTableExecutor {
|
|
133
|
-
#props;
|
|
134
|
-
constructor(props) {
|
|
135
|
-
this.#props = freeze(props);
|
|
136
|
-
}
|
|
137
|
-
toOperationNode() {
|
|
138
|
-
return this.#props.executor.transformQuery(this.#props.node, this.#props.queryId);
|
|
139
|
-
}
|
|
140
|
-
compile() {
|
|
141
|
-
return this.#props.executor.compileQuery(this.toOperationNode(), this.#props.queryId);
|
|
142
|
-
}
|
|
143
|
-
async execute() {
|
|
144
|
-
await this.#props.executor.executeQuery(this.compile(), this.#props.queryId);
|
|
145
|
-
}
|
|
146
|
-
}
|
|
147
135
|
export class AlterTableColumnAlteringBuilder {
|
|
148
136
|
#props;
|
|
149
137
|
constructor(props) {
|
|
150
|
-
this.#props = props;
|
|
138
|
+
this.#props = freeze(props);
|
|
151
139
|
}
|
|
152
140
|
alterColumn(column, alteration) {
|
|
153
141
|
const builder = alteration(new AlterColumnBuilder(AlterColumnNode.create(column)));
|
|
@@ -182,80 +170,6 @@ export class AlterTableColumnAlteringBuilder {
|
|
|
182
170
|
node: AlterTableNode.cloneWithColumnAlteration(this.#props.node, ModifyColumnNode.create(builder.toOperationNode())),
|
|
183
171
|
});
|
|
184
172
|
}
|
|
185
|
-
toOperationNode() {
|
|
186
|
-
return this.#props.node;
|
|
187
|
-
}
|
|
188
|
-
compile() {
|
|
189
|
-
return this.#props.executor.compileQuery(this.#props.node, this.#props.queryId);
|
|
190
|
-
}
|
|
191
|
-
async execute() {
|
|
192
|
-
await this.#props.executor.executeQuery(this.compile(), this.#props.queryId);
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
export class AlterTableAddForeignKeyConstraintBuilder {
|
|
196
|
-
#props;
|
|
197
|
-
constructor(props) {
|
|
198
|
-
this.#props = freeze(props);
|
|
199
|
-
}
|
|
200
|
-
onDelete(onDelete) {
|
|
201
|
-
return new AlterTableAddForeignKeyConstraintBuilder({
|
|
202
|
-
...this.#props,
|
|
203
|
-
constraintBuilder: this.#props.constraintBuilder.onDelete(onDelete),
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
onUpdate(onUpdate) {
|
|
207
|
-
return new AlterTableAddForeignKeyConstraintBuilder({
|
|
208
|
-
...this.#props,
|
|
209
|
-
constraintBuilder: this.#props.constraintBuilder.onUpdate(onUpdate),
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
toOperationNode() {
|
|
213
|
-
return this.#props.executor.transformQuery(AlterTableNode.cloneWithTableProps(this.#props.node, {
|
|
214
|
-
addConstraint: AddConstraintNode.create(this.#props.constraintBuilder.toOperationNode()),
|
|
215
|
-
}), this.#props.queryId);
|
|
216
|
-
}
|
|
217
|
-
compile() {
|
|
218
|
-
return this.#props.executor.compileQuery(this.toOperationNode(), this.#props.queryId);
|
|
219
|
-
}
|
|
220
|
-
async execute() {
|
|
221
|
-
await this.#props.executor.executeQuery(this.compile(), this.#props.queryId);
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
export class AlterTableDropConstraintBuilder {
|
|
225
|
-
#props;
|
|
226
|
-
constructor(props) {
|
|
227
|
-
this.#props = freeze(props);
|
|
228
|
-
}
|
|
229
|
-
ifExists() {
|
|
230
|
-
return new AlterTableDropConstraintBuilder({
|
|
231
|
-
...this.#props,
|
|
232
|
-
node: AlterTableNode.cloneWithTableProps(this.#props.node, {
|
|
233
|
-
dropConstraint: DropConstraintNode.cloneWith(this.#props.node.dropConstraint, {
|
|
234
|
-
ifExists: true,
|
|
235
|
-
}),
|
|
236
|
-
}),
|
|
237
|
-
});
|
|
238
|
-
}
|
|
239
|
-
cascade() {
|
|
240
|
-
return new AlterTableDropConstraintBuilder({
|
|
241
|
-
...this.#props,
|
|
242
|
-
node: AlterTableNode.cloneWithTableProps(this.#props.node, {
|
|
243
|
-
dropConstraint: DropConstraintNode.cloneWith(this.#props.node.dropConstraint, {
|
|
244
|
-
modifier: 'cascade',
|
|
245
|
-
}),
|
|
246
|
-
}),
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
restrict() {
|
|
250
|
-
return new AlterTableDropConstraintBuilder({
|
|
251
|
-
...this.#props,
|
|
252
|
-
node: AlterTableNode.cloneWithTableProps(this.#props.node, {
|
|
253
|
-
dropConstraint: DropConstraintNode.cloneWith(this.#props.node.dropConstraint, {
|
|
254
|
-
modifier: 'restrict',
|
|
255
|
-
}),
|
|
256
|
-
}),
|
|
257
|
-
});
|
|
258
|
-
}
|
|
259
173
|
toOperationNode() {
|
|
260
174
|
return this.#props.executor.transformQuery(this.#props.node, this.#props.queryId);
|
|
261
175
|
}
|
|
@@ -268,7 +182,4 @@ export class AlterTableDropConstraintBuilder {
|
|
|
268
182
|
}
|
|
269
183
|
preventAwait(AlterTableBuilder, "don't await AlterTableBuilder instances");
|
|
270
184
|
preventAwait(AlterColumnBuilder, "don't await AlterColumnBuilder instances");
|
|
271
|
-
preventAwait(AlterTableExecutor, "don't await AlterTableExecutor instances directly. To execute the query you need to call `execute`");
|
|
272
185
|
preventAwait(AlterTableColumnAlteringBuilder, "don't await AlterTableColumnAlteringBuilder instances directly. To execute the query you need to call `execute`");
|
|
273
|
-
preventAwait(AlterTableAddForeignKeyConstraintBuilder, "don't await AlterTableAddForeignKeyConstraintBuilder instances directly. To execute the query you need to call `execute`");
|
|
274
|
-
preventAwait(AlterTableDropConstraintBuilder, "don't await AlterTableDropConstraintBuilder instances directly. To execute the query you need to call `execute`");
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { AlterTableNode } from '../operation-node/alter-table-node.js';
|
|
2
|
+
import { OperationNodeSource } from '../operation-node/operation-node-source.js';
|
|
3
|
+
import { CompiledQuery } from '../query-compiler/compiled-query.js';
|
|
4
|
+
import { QueryExecutor } from '../query-executor/query-executor.js';
|
|
5
|
+
import { Compilable } from '../util/compilable.js';
|
|
6
|
+
import { QueryId } from '../util/query-id.js';
|
|
7
|
+
export declare class AlterTableDropConstraintBuilder implements OperationNodeSource, Compilable {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(props: AlterTableDropConstraintBuilderProps);
|
|
10
|
+
ifExists(): AlterTableDropConstraintBuilder;
|
|
11
|
+
cascade(): AlterTableDropConstraintBuilder;
|
|
12
|
+
restrict(): AlterTableDropConstraintBuilder;
|
|
13
|
+
toOperationNode(): AlterTableNode;
|
|
14
|
+
compile(): CompiledQuery;
|
|
15
|
+
execute(): Promise<void>;
|
|
16
|
+
}
|
|
17
|
+
export interface AlterTableDropConstraintBuilderProps {
|
|
18
|
+
readonly queryId: QueryId;
|
|
19
|
+
readonly executor: QueryExecutor;
|
|
20
|
+
readonly node: AlterTableNode;
|
|
21
|
+
}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
/// <reference types="./alter-table-drop-constraint-builder.d.ts" />
|
|
2
|
+
import { AlterTableNode } from '../operation-node/alter-table-node.js';
|
|
3
|
+
import { DropConstraintNode } from '../operation-node/drop-constraint-node.js';
|
|
4
|
+
import { freeze } from '../util/object-utils.js';
|
|
5
|
+
import { preventAwait } from '../util/prevent-await.js';
|
|
6
|
+
export class AlterTableDropConstraintBuilder {
|
|
7
|
+
#props;
|
|
8
|
+
constructor(props) {
|
|
9
|
+
this.#props = freeze(props);
|
|
10
|
+
}
|
|
11
|
+
ifExists() {
|
|
12
|
+
return new AlterTableDropConstraintBuilder({
|
|
13
|
+
...this.#props,
|
|
14
|
+
node: AlterTableNode.cloneWithTableProps(this.#props.node, {
|
|
15
|
+
dropConstraint: DropConstraintNode.cloneWith(this.#props.node.dropConstraint, {
|
|
16
|
+
ifExists: true,
|
|
17
|
+
}),
|
|
18
|
+
}),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
cascade() {
|
|
22
|
+
return new AlterTableDropConstraintBuilder({
|
|
23
|
+
...this.#props,
|
|
24
|
+
node: AlterTableNode.cloneWithTableProps(this.#props.node, {
|
|
25
|
+
dropConstraint: DropConstraintNode.cloneWith(this.#props.node.dropConstraint, {
|
|
26
|
+
modifier: 'cascade',
|
|
27
|
+
}),
|
|
28
|
+
}),
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
restrict() {
|
|
32
|
+
return new AlterTableDropConstraintBuilder({
|
|
33
|
+
...this.#props,
|
|
34
|
+
node: AlterTableNode.cloneWithTableProps(this.#props.node, {
|
|
35
|
+
dropConstraint: DropConstraintNode.cloneWith(this.#props.node.dropConstraint, {
|
|
36
|
+
modifier: 'restrict',
|
|
37
|
+
}),
|
|
38
|
+
}),
|
|
39
|
+
});
|
|
40
|
+
}
|
|
41
|
+
toOperationNode() {
|
|
42
|
+
return this.#props.executor.transformQuery(this.#props.node, this.#props.queryId);
|
|
43
|
+
}
|
|
44
|
+
compile() {
|
|
45
|
+
return this.#props.executor.compileQuery(this.toOperationNode(), this.#props.queryId);
|
|
46
|
+
}
|
|
47
|
+
async execute() {
|
|
48
|
+
await this.#props.executor.executeQuery(this.compile(), this.#props.queryId);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
preventAwait(AlterTableDropConstraintBuilder, "don't await AlterTableDropConstraintBuilder instances directly. To execute the query you need to call `execute`");
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { AlterTableNode } from '../operation-node/alter-table-node.js';
|
|
2
|
+
import { OperationNodeSource } from '../operation-node/operation-node-source.js';
|
|
3
|
+
import { CompiledQuery } from '../query-compiler/compiled-query.js';
|
|
4
|
+
import { QueryExecutor } from '../query-executor/query-executor.js';
|
|
5
|
+
import { Compilable } from '../util/compilable.js';
|
|
6
|
+
import { QueryId } from '../util/query-id.js';
|
|
7
|
+
export declare class AlterTableExecutor implements OperationNodeSource, Compilable {
|
|
8
|
+
#private;
|
|
9
|
+
constructor(props: AlterTableExecutorProps);
|
|
10
|
+
toOperationNode(): AlterTableNode;
|
|
11
|
+
compile(): CompiledQuery;
|
|
12
|
+
execute(): Promise<void>;
|
|
13
|
+
}
|
|
14
|
+
export interface AlterTableExecutorProps {
|
|
15
|
+
readonly queryId: QueryId;
|
|
16
|
+
readonly executor: QueryExecutor;
|
|
17
|
+
readonly node: AlterTableNode;
|
|
18
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/// <reference types="./alter-table-executor.d.ts" />
|
|
2
|
+
import { freeze } from '../util/object-utils.js';
|
|
3
|
+
import { preventAwait } from '../util/prevent-await.js';
|
|
4
|
+
export class AlterTableExecutor {
|
|
5
|
+
#props;
|
|
6
|
+
constructor(props) {
|
|
7
|
+
this.#props = freeze(props);
|
|
8
|
+
}
|
|
9
|
+
toOperationNode() {
|
|
10
|
+
return this.#props.executor.transformQuery(this.#props.node, this.#props.queryId);
|
|
11
|
+
}
|
|
12
|
+
compile() {
|
|
13
|
+
return this.#props.executor.compileQuery(this.toOperationNode(), this.#props.queryId);
|
|
14
|
+
}
|
|
15
|
+
async execute() {
|
|
16
|
+
await this.#props.executor.executeQuery(this.compile(), this.#props.queryId);
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
preventAwait(AlterTableExecutor, "don't await AlterTableExecutor instances directly. To execute the query you need to call `execute`");
|
|
@@ -56,5 +56,5 @@ export declare class CreateIndexBuilder implements OperationNodeSource, Compilab
|
|
|
56
56
|
export interface CreateIndexBuilderProps {
|
|
57
57
|
readonly queryId: QueryId;
|
|
58
58
|
readonly executor: QueryExecutor;
|
|
59
|
-
readonly
|
|
59
|
+
readonly node: CreateIndexNode;
|
|
60
60
|
}
|
|
@@ -17,7 +17,7 @@ export class CreateIndexBuilder {
|
|
|
17
17
|
unique() {
|
|
18
18
|
return new CreateIndexBuilder({
|
|
19
19
|
...this.#props,
|
|
20
|
-
|
|
20
|
+
node: CreateIndexNode.cloneWith(this.#props.node, {
|
|
21
21
|
unique: true,
|
|
22
22
|
}),
|
|
23
23
|
});
|
|
@@ -28,7 +28,7 @@ export class CreateIndexBuilder {
|
|
|
28
28
|
on(table) {
|
|
29
29
|
return new CreateIndexBuilder({
|
|
30
30
|
...this.#props,
|
|
31
|
-
|
|
31
|
+
node: CreateIndexNode.cloneWith(this.#props.node, {
|
|
32
32
|
table: parseTable(table),
|
|
33
33
|
}),
|
|
34
34
|
});
|
|
@@ -41,7 +41,7 @@ export class CreateIndexBuilder {
|
|
|
41
41
|
column(column) {
|
|
42
42
|
return new CreateIndexBuilder({
|
|
43
43
|
...this.#props,
|
|
44
|
-
|
|
44
|
+
node: CreateIndexNode.cloneWith(this.#props.node, {
|
|
45
45
|
expression: parseColumnName(column),
|
|
46
46
|
}),
|
|
47
47
|
});
|
|
@@ -54,7 +54,7 @@ export class CreateIndexBuilder {
|
|
|
54
54
|
columns(columns) {
|
|
55
55
|
return new CreateIndexBuilder({
|
|
56
56
|
...this.#props,
|
|
57
|
-
|
|
57
|
+
node: CreateIndexNode.cloneWith(this.#props.node, {
|
|
58
58
|
expression: ListNode.create(columns.map(parseColumnName)),
|
|
59
59
|
}),
|
|
60
60
|
});
|
|
@@ -77,7 +77,7 @@ export class CreateIndexBuilder {
|
|
|
77
77
|
expression(expression) {
|
|
78
78
|
return new CreateIndexBuilder({
|
|
79
79
|
...this.#props,
|
|
80
|
-
|
|
80
|
+
node: CreateIndexNode.cloneWith(this.#props.node, {
|
|
81
81
|
expression: expression.toOperationNode(),
|
|
82
82
|
}),
|
|
83
83
|
});
|
|
@@ -85,13 +85,13 @@ export class CreateIndexBuilder {
|
|
|
85
85
|
using(indexType) {
|
|
86
86
|
return new CreateIndexBuilder({
|
|
87
87
|
...this.#props,
|
|
88
|
-
|
|
88
|
+
node: CreateIndexNode.cloneWith(this.#props.node, {
|
|
89
89
|
using: RawNode.createWithSql(indexType),
|
|
90
90
|
}),
|
|
91
91
|
});
|
|
92
92
|
}
|
|
93
93
|
toOperationNode() {
|
|
94
|
-
return this.#props.executor.transformQuery(this.#props.
|
|
94
|
+
return this.#props.executor.transformQuery(this.#props.node, this.#props.queryId);
|
|
95
95
|
}
|
|
96
96
|
compile() {
|
|
97
97
|
return this.#props.executor.compileQuery(this.toOperationNode(), this.#props.queryId);
|
|
@@ -15,5 +15,5 @@ export declare class CreateSchemaBuilder implements OperationNodeSource, Compila
|
|
|
15
15
|
export interface CreateSchemaBuilderProps {
|
|
16
16
|
readonly queryId: QueryId;
|
|
17
17
|
readonly executor: QueryExecutor;
|
|
18
|
-
readonly
|
|
18
|
+
readonly node: CreateSchemaNode;
|
|
19
19
|
}
|
|
@@ -10,11 +10,11 @@ export class CreateSchemaBuilder {
|
|
|
10
10
|
ifNotExists() {
|
|
11
11
|
return new CreateSchemaBuilder({
|
|
12
12
|
...this.#props,
|
|
13
|
-
|
|
13
|
+
node: CreateSchemaNode.cloneWith(this.#props.node, { ifNotExists: true }),
|
|
14
14
|
});
|
|
15
15
|
}
|
|
16
16
|
toOperationNode() {
|
|
17
|
-
return this.#props.executor.transformQuery(this.#props.
|
|
17
|
+
return this.#props.executor.transformQuery(this.#props.node, this.#props.queryId);
|
|
18
18
|
}
|
|
19
19
|
compile() {
|
|
20
20
|
return this.#props.executor.compileQuery(this.toOperationNode(), this.#props.queryId);
|
|
@@ -243,7 +243,7 @@ export declare class CreateTableBuilder<TB extends string, C extends string = ne
|
|
|
243
243
|
export interface CreateTableBuilderProps {
|
|
244
244
|
readonly queryId: QueryId;
|
|
245
245
|
readonly executor: QueryExecutor;
|
|
246
|
-
readonly
|
|
246
|
+
readonly node: CreateTableNode;
|
|
247
247
|
}
|
|
248
248
|
export declare type ColumnBuilderCallback = (builder: ColumnDefinitionBuilder) => ColumnDefinitionBuilder;
|
|
249
249
|
export declare type ForeignKeyConstraintBuilderCallback = (builder: ForeignKeyConstraintBuilder) => ForeignKeyConstraintBuilder;
|
|
@@ -29,7 +29,7 @@ export class CreateTableBuilder {
|
|
|
29
29
|
temporary() {
|
|
30
30
|
return new CreateTableBuilder({
|
|
31
31
|
...this.#props,
|
|
32
|
-
|
|
32
|
+
node: CreateTableNode.cloneWith(this.#props.node, {
|
|
33
33
|
temporary: true,
|
|
34
34
|
}),
|
|
35
35
|
});
|
|
@@ -43,7 +43,7 @@ export class CreateTableBuilder {
|
|
|
43
43
|
onCommit(onCommit) {
|
|
44
44
|
return new CreateTableBuilder({
|
|
45
45
|
...this.#props,
|
|
46
|
-
|
|
46
|
+
node: CreateTableNode.cloneWith(this.#props.node, {
|
|
47
47
|
onCommit: parseOnCommitAction(onCommit),
|
|
48
48
|
}),
|
|
49
49
|
});
|
|
@@ -56,7 +56,7 @@ export class CreateTableBuilder {
|
|
|
56
56
|
ifNotExists() {
|
|
57
57
|
return new CreateTableBuilder({
|
|
58
58
|
...this.#props,
|
|
59
|
-
|
|
59
|
+
node: CreateTableNode.cloneWith(this.#props.node, {
|
|
60
60
|
ifNotExists: true,
|
|
61
61
|
}),
|
|
62
62
|
});
|
|
@@ -109,7 +109,7 @@ export class CreateTableBuilder {
|
|
|
109
109
|
const columnBuilder = build(new ColumnDefinitionBuilder(ColumnDefinitionNode.create(columnName, parseDataTypeExpression(dataType))));
|
|
110
110
|
return new CreateTableBuilder({
|
|
111
111
|
...this.#props,
|
|
112
|
-
|
|
112
|
+
node: CreateTableNode.cloneWithColumn(this.#props.node, columnBuilder.toOperationNode()),
|
|
113
113
|
});
|
|
114
114
|
}
|
|
115
115
|
/**
|
|
@@ -127,7 +127,7 @@ export class CreateTableBuilder {
|
|
|
127
127
|
addPrimaryKeyConstraint(constraintName, columns) {
|
|
128
128
|
return new CreateTableBuilder({
|
|
129
129
|
...this.#props,
|
|
130
|
-
|
|
130
|
+
node: CreateTableNode.cloneWithConstraint(this.#props.node, PrimaryConstraintNode.create(columns, constraintName)),
|
|
131
131
|
});
|
|
132
132
|
}
|
|
133
133
|
/**
|
|
@@ -145,7 +145,7 @@ export class CreateTableBuilder {
|
|
|
145
145
|
addUniqueConstraint(constraintName, columns) {
|
|
146
146
|
return new CreateTableBuilder({
|
|
147
147
|
...this.#props,
|
|
148
|
-
|
|
148
|
+
node: CreateTableNode.cloneWithConstraint(this.#props.node, UniqueConstraintNode.create(columns, constraintName)),
|
|
149
149
|
});
|
|
150
150
|
}
|
|
151
151
|
/**
|
|
@@ -165,7 +165,7 @@ export class CreateTableBuilder {
|
|
|
165
165
|
addCheckConstraint(constraintName, checkExpression) {
|
|
166
166
|
return new CreateTableBuilder({
|
|
167
167
|
...this.#props,
|
|
168
|
-
|
|
168
|
+
node: CreateTableNode.cloneWithConstraint(this.#props.node, CheckConstraintNode.create(checkExpression.toOperationNode(), constraintName)),
|
|
169
169
|
});
|
|
170
170
|
}
|
|
171
171
|
/**
|
|
@@ -201,7 +201,7 @@ export class CreateTableBuilder {
|
|
|
201
201
|
const builder = build(new ForeignKeyConstraintBuilder(ForeignKeyConstraintNode.create(columns.map(ColumnNode.create), parseTable(targetTable), targetColumns.map(ColumnNode.create), constraintName)));
|
|
202
202
|
return new CreateTableBuilder({
|
|
203
203
|
...this.#props,
|
|
204
|
-
|
|
204
|
+
node: CreateTableNode.cloneWithConstraint(this.#props.node, builder.toOperationNode()),
|
|
205
205
|
});
|
|
206
206
|
}
|
|
207
207
|
/**
|
|
@@ -233,7 +233,7 @@ export class CreateTableBuilder {
|
|
|
233
233
|
modifyFront(modifier) {
|
|
234
234
|
return new CreateTableBuilder({
|
|
235
235
|
...this.#props,
|
|
236
|
-
|
|
236
|
+
node: CreateTableNode.cloneWithFrontModifier(this.#props.node, modifier.toOperationNode()),
|
|
237
237
|
});
|
|
238
238
|
}
|
|
239
239
|
/**
|
|
@@ -265,7 +265,7 @@ export class CreateTableBuilder {
|
|
|
265
265
|
modifyEnd(modifier) {
|
|
266
266
|
return new CreateTableBuilder({
|
|
267
267
|
...this.#props,
|
|
268
|
-
|
|
268
|
+
node: CreateTableNode.cloneWithEndModifier(this.#props.node, modifier.toOperationNode()),
|
|
269
269
|
});
|
|
270
270
|
}
|
|
271
271
|
/**
|
|
@@ -304,7 +304,7 @@ export class CreateTableBuilder {
|
|
|
304
304
|
return func(this);
|
|
305
305
|
}
|
|
306
306
|
toOperationNode() {
|
|
307
|
-
return this.#props.executor.transformQuery(this.#props.
|
|
307
|
+
return this.#props.executor.transformQuery(this.#props.node, this.#props.queryId);
|
|
308
308
|
}
|
|
309
309
|
compile() {
|
|
310
310
|
return this.#props.executor.compileQuery(this.toOperationNode(), this.#props.queryId);
|
|
@@ -24,5 +24,5 @@ export declare class CreateTypeBuilder implements OperationNodeSource, Compilabl
|
|
|
24
24
|
export interface CreateTypeBuilderProps {
|
|
25
25
|
readonly queryId: QueryId;
|
|
26
26
|
readonly executor: QueryExecutor;
|
|
27
|
-
readonly
|
|
27
|
+
readonly node: CreateTypeNode;
|
|
28
28
|
}
|
|
@@ -8,7 +8,7 @@ export class CreateTypeBuilder {
|
|
|
8
8
|
this.#props = freeze(props);
|
|
9
9
|
}
|
|
10
10
|
toOperationNode() {
|
|
11
|
-
return this.#props.executor.transformQuery(this.#props.
|
|
11
|
+
return this.#props.executor.transformQuery(this.#props.node, this.#props.queryId);
|
|
12
12
|
}
|
|
13
13
|
/**
|
|
14
14
|
* Creates an anum type.
|
|
@@ -22,7 +22,7 @@ export class CreateTypeBuilder {
|
|
|
22
22
|
asEnum(values) {
|
|
23
23
|
return new CreateTypeBuilder({
|
|
24
24
|
...this.#props,
|
|
25
|
-
|
|
25
|
+
node: CreateTypeNode.cloneWithEnum(this.#props.node, values),
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
compile() {
|
|
@@ -39,5 +39,5 @@ export declare class CreateViewBuilder implements OperationNodeSource, Compilabl
|
|
|
39
39
|
export interface CreateViewBuilderProps {
|
|
40
40
|
readonly queryId: QueryId;
|
|
41
41
|
readonly executor: QueryExecutor;
|
|
42
|
-
readonly
|
|
42
|
+
readonly node: CreateViewNode;
|
|
43
43
|
}
|
|
@@ -17,7 +17,7 @@ export class CreateViewBuilder {
|
|
|
17
17
|
temporary() {
|
|
18
18
|
return new CreateViewBuilder({
|
|
19
19
|
...this.#props,
|
|
20
|
-
|
|
20
|
+
node: CreateViewNode.cloneWith(this.#props.node, {
|
|
21
21
|
temporary: true,
|
|
22
22
|
}),
|
|
23
23
|
});
|
|
@@ -25,7 +25,7 @@ export class CreateViewBuilder {
|
|
|
25
25
|
materialized() {
|
|
26
26
|
return new CreateViewBuilder({
|
|
27
27
|
...this.#props,
|
|
28
|
-
|
|
28
|
+
node: CreateViewNode.cloneWith(this.#props.node, {
|
|
29
29
|
materialized: true,
|
|
30
30
|
}),
|
|
31
31
|
});
|
|
@@ -36,7 +36,7 @@ export class CreateViewBuilder {
|
|
|
36
36
|
ifNotExists() {
|
|
37
37
|
return new CreateViewBuilder({
|
|
38
38
|
...this.#props,
|
|
39
|
-
|
|
39
|
+
node: CreateViewNode.cloneWith(this.#props.node, {
|
|
40
40
|
ifNotExists: true,
|
|
41
41
|
}),
|
|
42
42
|
});
|
|
@@ -44,7 +44,7 @@ export class CreateViewBuilder {
|
|
|
44
44
|
orReplace() {
|
|
45
45
|
return new CreateViewBuilder({
|
|
46
46
|
...this.#props,
|
|
47
|
-
|
|
47
|
+
node: CreateViewNode.cloneWith(this.#props.node, {
|
|
48
48
|
orReplace: true,
|
|
49
49
|
}),
|
|
50
50
|
});
|
|
@@ -52,7 +52,7 @@ export class CreateViewBuilder {
|
|
|
52
52
|
columns(columns) {
|
|
53
53
|
return new CreateViewBuilder({
|
|
54
54
|
...this.#props,
|
|
55
|
-
|
|
55
|
+
node: CreateViewNode.cloneWith(this.#props.node, {
|
|
56
56
|
columns: columns.map(parseColumnName),
|
|
57
57
|
}),
|
|
58
58
|
});
|
|
@@ -72,13 +72,13 @@ export class CreateViewBuilder {
|
|
|
72
72
|
.toOperationNode();
|
|
73
73
|
return new CreateViewBuilder({
|
|
74
74
|
...this.#props,
|
|
75
|
-
|
|
75
|
+
node: CreateViewNode.cloneWith(this.#props.node, {
|
|
76
76
|
as: queryNode,
|
|
77
77
|
}),
|
|
78
78
|
});
|
|
79
79
|
}
|
|
80
80
|
toOperationNode() {
|
|
81
|
-
return this.#props.executor.transformQuery(this.#props.
|
|
81
|
+
return this.#props.executor.transformQuery(this.#props.node, this.#props.queryId);
|
|
82
82
|
}
|
|
83
83
|
compile() {
|
|
84
84
|
return this.#props.executor.compileQuery(this.toOperationNode(), this.#props.queryId);
|
|
@@ -21,5 +21,5 @@ export declare class DropIndexBuilder implements OperationNodeSource, Compilable
|
|
|
21
21
|
export interface DropIndexBuilderProps {
|
|
22
22
|
readonly queryId: QueryId;
|
|
23
23
|
readonly executor: QueryExecutor;
|
|
24
|
-
readonly
|
|
24
|
+
readonly node: DropIndexNode;
|
|
25
25
|
}
|
|
@@ -15,7 +15,7 @@ export class DropIndexBuilder {
|
|
|
15
15
|
on(table) {
|
|
16
16
|
return new DropIndexBuilder({
|
|
17
17
|
...this.#props,
|
|
18
|
-
|
|
18
|
+
node: DropIndexNode.cloneWith(this.#props.node, {
|
|
19
19
|
table: parseTable(table),
|
|
20
20
|
}),
|
|
21
21
|
});
|
|
@@ -23,7 +23,7 @@ export class DropIndexBuilder {
|
|
|
23
23
|
ifExists() {
|
|
24
24
|
return new DropIndexBuilder({
|
|
25
25
|
...this.#props,
|
|
26
|
-
|
|
26
|
+
node: DropIndexNode.cloneWith(this.#props.node, {
|
|
27
27
|
ifExists: true,
|
|
28
28
|
}),
|
|
29
29
|
});
|
|
@@ -31,13 +31,13 @@ export class DropIndexBuilder {
|
|
|
31
31
|
cascade() {
|
|
32
32
|
return new DropIndexBuilder({
|
|
33
33
|
...this.#props,
|
|
34
|
-
|
|
34
|
+
node: DropIndexNode.cloneWith(this.#props.node, {
|
|
35
35
|
cascade: true,
|
|
36
36
|
}),
|
|
37
37
|
});
|
|
38
38
|
}
|
|
39
39
|
toOperationNode() {
|
|
40
|
-
return this.#props.executor.transformQuery(this.#props.
|
|
40
|
+
return this.#props.executor.transformQuery(this.#props.node, this.#props.queryId);
|
|
41
41
|
}
|
|
42
42
|
compile() {
|
|
43
43
|
return this.#props.executor.compileQuery(this.toOperationNode(), this.#props.queryId);
|
|
@@ -16,5 +16,5 @@ export declare class DropSchemaBuilder implements OperationNodeSource, Compilabl
|
|
|
16
16
|
export interface DropSchemaBuilderProps {
|
|
17
17
|
readonly queryId: QueryId;
|
|
18
18
|
readonly executor: QueryExecutor;
|
|
19
|
-
readonly
|
|
19
|
+
readonly node: DropSchemaNode;
|
|
20
20
|
}
|
|
@@ -10,7 +10,7 @@ export class DropSchemaBuilder {
|
|
|
10
10
|
ifExists() {
|
|
11
11
|
return new DropSchemaBuilder({
|
|
12
12
|
...this.#props,
|
|
13
|
-
|
|
13
|
+
node: DropSchemaNode.cloneWith(this.#props.node, {
|
|
14
14
|
ifExists: true,
|
|
15
15
|
}),
|
|
16
16
|
});
|
|
@@ -18,13 +18,13 @@ export class DropSchemaBuilder {
|
|
|
18
18
|
cascade() {
|
|
19
19
|
return new DropSchemaBuilder({
|
|
20
20
|
...this.#props,
|
|
21
|
-
|
|
21
|
+
node: DropSchemaNode.cloneWith(this.#props.node, {
|
|
22
22
|
cascade: true,
|
|
23
23
|
}),
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
toOperationNode() {
|
|
27
|
-
return this.#props.executor.transformQuery(this.#props.
|
|
27
|
+
return this.#props.executor.transformQuery(this.#props.node, this.#props.queryId);
|
|
28
28
|
}
|
|
29
29
|
compile() {
|
|
30
30
|
return this.#props.executor.compileQuery(this.toOperationNode(), this.#props.queryId);
|
|
@@ -16,5 +16,5 @@ export declare class DropTableBuilder implements OperationNodeSource, Compilable
|
|
|
16
16
|
export interface DropTableBuilderProps {
|
|
17
17
|
readonly queryId: QueryId;
|
|
18
18
|
readonly executor: QueryExecutor;
|
|
19
|
-
readonly
|
|
19
|
+
readonly node: DropTableNode;
|
|
20
20
|
}
|
|
@@ -10,7 +10,7 @@ export class DropTableBuilder {
|
|
|
10
10
|
ifExists() {
|
|
11
11
|
return new DropTableBuilder({
|
|
12
12
|
...this.#props,
|
|
13
|
-
|
|
13
|
+
node: DropTableNode.cloneWith(this.#props.node, {
|
|
14
14
|
ifExists: true,
|
|
15
15
|
}),
|
|
16
16
|
});
|
|
@@ -18,13 +18,13 @@ export class DropTableBuilder {
|
|
|
18
18
|
cascade() {
|
|
19
19
|
return new DropTableBuilder({
|
|
20
20
|
...this.#props,
|
|
21
|
-
|
|
21
|
+
node: DropTableNode.cloneWith(this.#props.node, {
|
|
22
22
|
cascade: true,
|
|
23
23
|
}),
|
|
24
24
|
});
|
|
25
25
|
}
|
|
26
26
|
toOperationNode() {
|
|
27
|
-
return this.#props.executor.transformQuery(this.#props.
|
|
27
|
+
return this.#props.executor.transformQuery(this.#props.node, this.#props.queryId);
|
|
28
28
|
}
|
|
29
29
|
compile() {
|
|
30
30
|
return this.#props.executor.compileQuery(this.toOperationNode(), this.#props.queryId);
|
|
@@ -15,5 +15,5 @@ export declare class DropTypeBuilder implements OperationNodeSource, Compilable
|
|
|
15
15
|
export interface DropTypeBuilderProps {
|
|
16
16
|
readonly queryId: QueryId;
|
|
17
17
|
readonly executor: QueryExecutor;
|
|
18
|
-
readonly
|
|
18
|
+
readonly node: DropTypeNode;
|
|
19
19
|
}
|