kysely 0.12.1 → 0.14.1
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 +34 -10
- package/dist/cjs/{introspection → dialect}/database-introspector.d.ts +0 -0
- package/dist/cjs/{introspection → dialect}/database-introspector.js +0 -0
- package/dist/cjs/dialect/dialect.d.ts +1 -1
- package/dist/cjs/dialect/mysql/mysql-adapter.d.ts +2 -2
- package/dist/cjs/dialect/mysql/mysql-adapter.js +2 -1
- package/dist/cjs/dialect/mysql/mysql-dialect.d.ts +1 -1
- package/dist/cjs/dialect/mysql/mysql-introspector.d.ts +1 -1
- package/dist/cjs/dialect/postgres/postgres-adapter.d.ts +2 -2
- package/dist/cjs/dialect/postgres/postgres-adapter.js +2 -1
- package/dist/cjs/dialect/postgres/postgres-dialect.d.ts +1 -1
- package/dist/cjs/dialect/postgres/postgres-introspector.d.ts +1 -1
- package/dist/cjs/dialect/sqlite/sqlite-adapter.d.ts +2 -2
- package/dist/cjs/dialect/sqlite/sqlite-dialect.d.ts +1 -1
- package/dist/cjs/dialect/sqlite/sqlite-introspector.d.ts +1 -1
- package/dist/cjs/index.d.ts +5 -3
- package/dist/cjs/index.js +4 -2
- package/dist/cjs/kysely.d.ts +152 -1
- package/dist/cjs/kysely.js +37 -0
- package/dist/cjs/migration/migration.d.ts +154 -11
- package/dist/cjs/migration/migration.js +256 -135
- package/dist/cjs/operation-node/check-constraint-node.d.ts +1 -1
- package/dist/cjs/operation-node/check-constraint-node.js +2 -3
- package/dist/cjs/operation-node/column-definition-node.d.ts +8 -7
- package/dist/cjs/operation-node/column-definition-node.js +0 -4
- package/dist/cjs/operation-node/common-table-expression-name-node.d.ts +15 -0
- package/dist/cjs/operation-node/common-table-expression-name-node.js +23 -0
- package/dist/cjs/operation-node/common-table-expression-node.d.ts +3 -3
- package/dist/cjs/operation-node/data-type-node.d.ts +1 -1
- package/dist/cjs/operation-node/generated-node.d.ts +20 -0
- package/dist/cjs/operation-node/generated-node.js +31 -0
- package/dist/cjs/operation-node/on-conflict-node.d.ts +13 -2
- package/dist/cjs/operation-node/on-conflict-node.js +39 -1
- package/dist/cjs/operation-node/operation-node-transformer.d.ts +4 -2
- package/dist/cjs/operation-node/operation-node-transformer.js +22 -6
- package/dist/cjs/operation-node/operation-node-visitor.d.ts +4 -2
- package/dist/cjs/operation-node/operation-node-visitor.js +2 -1
- package/dist/cjs/operation-node/operation-node.d.ts +1 -1
- package/dist/cjs/operation-node/with-node.d.ts +3 -1
- package/dist/cjs/operation-node/with-node.js +2 -1
- package/dist/cjs/parser/reference-parser.d.ts +2 -2
- package/dist/cjs/parser/select-parser.d.ts +2 -2
- package/dist/cjs/parser/with-parser.d.ts +32 -5
- package/dist/cjs/parser/with-parser.js +13 -2
- package/dist/cjs/plugin/camel-case/camel-case-plugin.d.ts +2 -2
- package/dist/cjs/plugin/with-schema/with-schema-transformer.js +8 -0
- package/dist/cjs/query-builder/insert-query-builder.d.ts +76 -75
- package/dist/cjs/query-builder/insert-query-builder.js +150 -15
- package/dist/cjs/query-builder/on-conflict-builder.d.ts +686 -0
- package/dist/cjs/query-builder/on-conflict-builder.js +323 -0
- package/dist/cjs/query-compiler/default-query-compiler.d.ts +4 -2
- package/dist/cjs/query-compiler/default-query-compiler.js +48 -8
- package/dist/cjs/query-creator.d.ts +27 -3
- package/dist/cjs/query-creator.js +33 -1
- package/dist/cjs/query-executor/default-query-executor.d.ts +19 -0
- package/dist/cjs/query-executor/noop-query-executor.d.ts +19 -0
- package/dist/cjs/raw-builder/raw-builder.js +1 -1
- package/dist/cjs/schema/alter-table-builder.d.ts +41 -9
- package/dist/cjs/schema/alter-table-builder.js +45 -9
- package/dist/cjs/schema/column-definition-builder.d.ts +40 -8
- package/dist/cjs/schema/column-definition-builder.js +21 -8
- package/dist/cjs/schema/create-index-builder.d.ts +3 -2
- package/dist/cjs/schema/create-index-builder.js +2 -2
- package/dist/cjs/schema/create-table-builder.d.ts +3 -2
- package/dist/cjs/schema/create-table-builder.js +2 -2
- package/dist/cjs/util/type-utils.d.ts +11 -7
- package/dist/esm/{introspection → dialect}/database-introspector.d.ts +0 -0
- package/dist/esm/{introspection → dialect}/database-introspector.js +0 -0
- package/dist/esm/dialect/dialect.d.ts +1 -1
- package/dist/esm/dialect/mysql/mysql-adapter.d.ts +2 -2
- package/dist/esm/dialect/mysql/mysql-adapter.js +2 -1
- package/dist/esm/dialect/mysql/mysql-dialect.d.ts +1 -1
- package/dist/esm/dialect/mysql/mysql-introspector.d.ts +1 -1
- package/dist/esm/dialect/postgres/postgres-adapter.d.ts +2 -2
- package/dist/esm/dialect/postgres/postgres-adapter.js +2 -1
- package/dist/esm/dialect/postgres/postgres-dialect.d.ts +1 -1
- package/dist/esm/dialect/postgres/postgres-introspector.d.ts +1 -1
- package/dist/esm/dialect/sqlite/sqlite-adapter.d.ts +2 -2
- package/dist/esm/dialect/sqlite/sqlite-dialect.d.ts +1 -1
- package/dist/esm/dialect/sqlite/sqlite-introspector.d.ts +1 -1
- package/dist/esm/index.d.ts +5 -3
- package/dist/esm/index.js +4 -2
- package/dist/esm/kysely.d.ts +152 -1
- package/dist/esm/kysely.js +37 -0
- package/dist/esm/migration/migration.d.ts +154 -11
- package/dist/esm/migration/migration.js +255 -134
- package/dist/esm/operation-node/check-constraint-node.d.ts +1 -1
- package/dist/esm/operation-node/check-constraint-node.js +2 -3
- package/dist/esm/operation-node/column-definition-node.d.ts +8 -7
- package/dist/esm/operation-node/column-definition-node.js +0 -4
- package/dist/esm/operation-node/common-table-expression-name-node.d.ts +15 -0
- package/dist/esm/operation-node/common-table-expression-name-node.js +20 -0
- package/dist/esm/operation-node/common-table-expression-node.d.ts +3 -3
- package/dist/esm/operation-node/data-type-node.d.ts +1 -1
- package/dist/esm/operation-node/generated-node.d.ts +20 -0
- package/dist/esm/operation-node/generated-node.js +28 -0
- package/dist/esm/operation-node/on-conflict-node.d.ts +13 -2
- package/dist/esm/operation-node/on-conflict-node.js +39 -1
- package/dist/esm/operation-node/operation-node-transformer.d.ts +4 -2
- package/dist/esm/operation-node/operation-node-transformer.js +22 -6
- package/dist/esm/operation-node/operation-node-visitor.d.ts +4 -2
- package/dist/esm/operation-node/operation-node-visitor.js +2 -1
- package/dist/esm/operation-node/operation-node.d.ts +1 -1
- package/dist/esm/operation-node/with-node.d.ts +3 -1
- package/dist/esm/operation-node/with-node.js +2 -1
- package/dist/esm/parser/reference-parser.d.ts +2 -2
- package/dist/esm/parser/select-parser.d.ts +2 -2
- package/dist/esm/parser/with-parser.d.ts +32 -5
- package/dist/esm/parser/with-parser.js +13 -2
- package/dist/esm/plugin/camel-case/camel-case-plugin.d.ts +2 -2
- package/dist/esm/plugin/with-schema/with-schema-transformer.js +8 -0
- package/dist/esm/query-builder/insert-query-builder.d.ts +76 -75
- package/dist/esm/query-builder/insert-query-builder.js +150 -15
- package/dist/esm/query-builder/on-conflict-builder.d.ts +686 -0
- package/dist/esm/query-builder/on-conflict-builder.js +317 -0
- package/dist/esm/query-compiler/default-query-compiler.d.ts +4 -2
- package/dist/esm/query-compiler/default-query-compiler.js +48 -8
- package/dist/esm/query-creator.d.ts +27 -3
- package/dist/esm/query-creator.js +33 -1
- package/dist/esm/query-executor/default-query-executor.d.ts +19 -0
- package/dist/esm/query-executor/noop-query-executor.d.ts +19 -0
- package/dist/esm/raw-builder/raw-builder.js +1 -1
- package/dist/esm/schema/alter-table-builder.d.ts +41 -9
- package/dist/esm/schema/alter-table-builder.js +45 -9
- package/dist/esm/schema/column-definition-builder.d.ts +40 -8
- package/dist/esm/schema/column-definition-builder.js +21 -8
- package/dist/esm/schema/create-index-builder.d.ts +3 -2
- package/dist/esm/schema/create-index-builder.js +2 -2
- package/dist/esm/schema/create-table-builder.d.ts +3 -2
- package/dist/esm/schema/create-table-builder.js +2 -2
- package/dist/esm/util/type-utils.d.ts +11 -7
- package/package.json +2 -2
- package/dist/cjs/operation-node/generated-always-as-node.d.ts +0 -16
- package/dist/cjs/operation-node/generated-always-as-node.js +0 -25
- package/dist/cjs/parser/on-conflict-parser.d.ts +0 -10
- package/dist/cjs/parser/on-conflict-parser.js +0 -35
- package/dist/esm/operation-node/generated-always-as-node.d.ts +0 -16
- package/dist/esm/operation-node/generated-always-as-node.js +0 -22
- package/dist/esm/parser/on-conflict-parser.d.ts +0 -10
- package/dist/esm/parser/on-conflict-parser.js +0 -30
|
@@ -31,7 +31,7 @@ export declare class AlterTableBuilder {
|
|
|
31
31
|
*/
|
|
32
32
|
modifyColumn(columnName: string, dataType: DataTypeExpression): AlterTableModifyColumnBuilder;
|
|
33
33
|
addUniqueConstraint(constraintName: string, columns: string[]): AlterTableExecutor;
|
|
34
|
-
addCheckConstraint(constraintName: string, checkExpression:
|
|
34
|
+
addCheckConstraint(constraintName: string, checkExpression: AnyRawBuilder): AlterTableExecutor;
|
|
35
35
|
addForeignKeyConstraint(constraintName: string, columns: string[], targetTable: string, targetColumns: string[]): AlterTableAddForeignKeyConstraintBuilder;
|
|
36
36
|
}
|
|
37
37
|
export interface AlterTableBuilderProps {
|
|
@@ -124,6 +124,12 @@ export declare class AlterTableAddColumnBuilder implements ColumnDefinitionBuild
|
|
|
124
124
|
* Adds a `not null` constraint for the column.
|
|
125
125
|
*/
|
|
126
126
|
notNull(): AlterTableAddColumnBuilder;
|
|
127
|
+
/**
|
|
128
|
+
* Adds a `unsigned` modifier for the column.
|
|
129
|
+
*
|
|
130
|
+
* This only works on some dialects like MySQL.
|
|
131
|
+
*/
|
|
132
|
+
unsigned(): AlterTableAddColumnBuilder;
|
|
127
133
|
/**
|
|
128
134
|
* Adds a default value constraint for the column.
|
|
129
135
|
*
|
|
@@ -145,11 +151,13 @@ export declare class AlterTableAddColumnBuilder implements ColumnDefinitionBuild
|
|
|
145
151
|
* ```ts
|
|
146
152
|
* db.schema
|
|
147
153
|
* .createTable('pet')
|
|
148
|
-
* .addColumn('number_of_legs', 'integer', (col) =>
|
|
154
|
+
* .addColumn('number_of_legs', 'integer', (col) =>
|
|
155
|
+
* col.check(db.raw('number_of_legs < 5'))
|
|
156
|
+
* )
|
|
149
157
|
* .execute()
|
|
150
158
|
* ```
|
|
151
159
|
*/
|
|
152
|
-
check(
|
|
160
|
+
check(expression: AnyRawBuilder): AlterTableAddColumnBuilder;
|
|
153
161
|
/**
|
|
154
162
|
* Makes the column a generated column using a `generated always as` statement.
|
|
155
163
|
*
|
|
@@ -159,12 +167,20 @@ export declare class AlterTableAddColumnBuilder implements ColumnDefinitionBuild
|
|
|
159
167
|
* db.schema
|
|
160
168
|
* .createTable('person')
|
|
161
169
|
* .addColumn('full_name', 'varchar(255)',
|
|
162
|
-
* (col) => col.generatedAlwaysAs("concat(first_name, ' ', last_name)")
|
|
170
|
+
* (col) => col.generatedAlwaysAs(db.raw("concat(first_name, ' ', last_name)"))
|
|
163
171
|
* )
|
|
164
172
|
* .execute()
|
|
165
173
|
* ```
|
|
166
174
|
*/
|
|
167
|
-
generatedAlwaysAs(
|
|
175
|
+
generatedAlwaysAs(expression: AnyRawBuilder): AlterTableAddColumnBuilder;
|
|
176
|
+
/**
|
|
177
|
+
* Adds the `generated always as identity` specifier on supported dialects.
|
|
178
|
+
*/
|
|
179
|
+
generatedAlwaysAsIdentity(): AlterTableAddColumnBuilder;
|
|
180
|
+
/**
|
|
181
|
+
* Adds the `generated by default as identity` specifier on supported dialects.
|
|
182
|
+
*/
|
|
183
|
+
generatedByDefaultAsIdentity(): AlterTableAddColumnBuilder;
|
|
168
184
|
/**
|
|
169
185
|
* Makes a generated column stored instead of virtual. This method can only
|
|
170
186
|
* be used with {@link generatedAlwaysAs}
|
|
@@ -253,6 +269,12 @@ export declare class AlterTableModifyColumnBuilder implements ColumnDefinitionBu
|
|
|
253
269
|
* Adds a `not null` constraint for the column.
|
|
254
270
|
*/
|
|
255
271
|
notNull(): AlterTableModifyColumnBuilder;
|
|
272
|
+
/**
|
|
273
|
+
* Adds a `unsigned` modifier for the column.
|
|
274
|
+
*
|
|
275
|
+
* This only works on some dialects like MySQL.
|
|
276
|
+
*/
|
|
277
|
+
unsigned(): AlterTableModifyColumnBuilder;
|
|
256
278
|
/**
|
|
257
279
|
* Adds a default value constraint for the column.
|
|
258
280
|
*
|
|
@@ -274,11 +296,13 @@ export declare class AlterTableModifyColumnBuilder implements ColumnDefinitionBu
|
|
|
274
296
|
* ```ts
|
|
275
297
|
* db.schema
|
|
276
298
|
* .createTable('pet')
|
|
277
|
-
* .addColumn('number_of_legs', 'integer', (col) =>
|
|
299
|
+
* .addColumn('number_of_legs', 'integer', (col) =>
|
|
300
|
+
* col.check(db.raw('number_of_legs < 5'))
|
|
301
|
+
* )
|
|
278
302
|
* .execute()
|
|
279
303
|
* ```
|
|
280
304
|
*/
|
|
281
|
-
check(
|
|
305
|
+
check(expression: AnyRawBuilder): AlterTableModifyColumnBuilder;
|
|
282
306
|
/**
|
|
283
307
|
* Makes the column a generated column using a `generated always as` statement.
|
|
284
308
|
*
|
|
@@ -288,12 +312,20 @@ export declare class AlterTableModifyColumnBuilder implements ColumnDefinitionBu
|
|
|
288
312
|
* db.schema
|
|
289
313
|
* .createTable('person')
|
|
290
314
|
* .addColumn('full_name', 'varchar(255)',
|
|
291
|
-
* (col) => col.generatedAlwaysAs("concat(first_name, ' ', last_name)")
|
|
315
|
+
* (col) => col.generatedAlwaysAs(db.raw("concat(first_name, ' ', last_name)"))
|
|
292
316
|
* )
|
|
293
317
|
* .execute()
|
|
294
318
|
* ```
|
|
295
319
|
*/
|
|
296
|
-
generatedAlwaysAs(
|
|
320
|
+
generatedAlwaysAs(expression: AnyRawBuilder): AlterTableModifyColumnBuilder;
|
|
321
|
+
/**
|
|
322
|
+
* Adds the `generated always as identity` specifier on supported dialects.
|
|
323
|
+
*/
|
|
324
|
+
generatedAlwaysAsIdentity(): AlterTableModifyColumnBuilder;
|
|
325
|
+
/**
|
|
326
|
+
* Adds the `generated by default as identity` specifier on supported dialects.
|
|
327
|
+
*/
|
|
328
|
+
generatedByDefaultAsIdentity(): AlterTableModifyColumnBuilder;
|
|
297
329
|
/**
|
|
298
330
|
* Makes a generated column stored instead of virtual. This method can only
|
|
299
331
|
* be used with {@link generatedAlwaysAs}
|
|
@@ -95,7 +95,7 @@ export class AlterTableBuilder {
|
|
|
95
95
|
return new AlterTableExecutor({
|
|
96
96
|
...this.#props,
|
|
97
97
|
alterTableNode: AlterTableNode.cloneWith(this.#props.alterTableNode, {
|
|
98
|
-
addConstraint: AddConstraintNode.create(CheckConstraintNode.create(checkExpression, constraintName)),
|
|
98
|
+
addConstraint: AddConstraintNode.create(CheckConstraintNode.create(checkExpression.toOperationNode(), constraintName)),
|
|
99
99
|
}),
|
|
100
100
|
});
|
|
101
101
|
}
|
|
@@ -226,22 +226,40 @@ export class AlterTableAddColumnBuilder {
|
|
|
226
226
|
columnBuilder: this.#props.columnBuilder.notNull(),
|
|
227
227
|
});
|
|
228
228
|
}
|
|
229
|
+
unsigned() {
|
|
230
|
+
return new AlterTableAddColumnBuilder({
|
|
231
|
+
...this.#props,
|
|
232
|
+
columnBuilder: this.#props.columnBuilder.unsigned(),
|
|
233
|
+
});
|
|
234
|
+
}
|
|
229
235
|
defaultTo(value) {
|
|
230
236
|
return new AlterTableAddColumnBuilder({
|
|
231
237
|
...this.#props,
|
|
232
238
|
columnBuilder: this.#props.columnBuilder.defaultTo(value),
|
|
233
239
|
});
|
|
234
240
|
}
|
|
235
|
-
check(
|
|
241
|
+
check(expression) {
|
|
242
|
+
return new AlterTableAddColumnBuilder({
|
|
243
|
+
...this.#props,
|
|
244
|
+
columnBuilder: this.#props.columnBuilder.check(expression),
|
|
245
|
+
});
|
|
246
|
+
}
|
|
247
|
+
generatedAlwaysAs(expression) {
|
|
248
|
+
return new AlterTableAddColumnBuilder({
|
|
249
|
+
...this.#props,
|
|
250
|
+
columnBuilder: this.#props.columnBuilder.generatedAlwaysAs(expression),
|
|
251
|
+
});
|
|
252
|
+
}
|
|
253
|
+
generatedAlwaysAsIdentity() {
|
|
236
254
|
return new AlterTableAddColumnBuilder({
|
|
237
255
|
...this.#props,
|
|
238
|
-
columnBuilder: this.#props.columnBuilder.
|
|
256
|
+
columnBuilder: this.#props.columnBuilder.generatedAlwaysAsIdentity(),
|
|
239
257
|
});
|
|
240
258
|
}
|
|
241
|
-
|
|
259
|
+
generatedByDefaultAsIdentity() {
|
|
242
260
|
return new AlterTableAddColumnBuilder({
|
|
243
261
|
...this.#props,
|
|
244
|
-
columnBuilder: this.#props.columnBuilder.
|
|
262
|
+
columnBuilder: this.#props.columnBuilder.generatedByDefaultAsIdentity(),
|
|
245
263
|
});
|
|
246
264
|
}
|
|
247
265
|
stored() {
|
|
@@ -309,22 +327,40 @@ export class AlterTableModifyColumnBuilder {
|
|
|
309
327
|
columnBuilder: this.#props.columnBuilder.notNull(),
|
|
310
328
|
});
|
|
311
329
|
}
|
|
330
|
+
unsigned() {
|
|
331
|
+
return new AlterTableModifyColumnBuilder({
|
|
332
|
+
...this.#props,
|
|
333
|
+
columnBuilder: this.#props.columnBuilder.unsigned(),
|
|
334
|
+
});
|
|
335
|
+
}
|
|
312
336
|
defaultTo(value) {
|
|
313
337
|
return new AlterTableModifyColumnBuilder({
|
|
314
338
|
...this.#props,
|
|
315
339
|
columnBuilder: this.#props.columnBuilder.defaultTo(value),
|
|
316
340
|
});
|
|
317
341
|
}
|
|
318
|
-
check(
|
|
342
|
+
check(expression) {
|
|
343
|
+
return new AlterTableModifyColumnBuilder({
|
|
344
|
+
...this.#props,
|
|
345
|
+
columnBuilder: this.#props.columnBuilder.check(expression),
|
|
346
|
+
});
|
|
347
|
+
}
|
|
348
|
+
generatedAlwaysAs(expression) {
|
|
349
|
+
return new AlterTableModifyColumnBuilder({
|
|
350
|
+
...this.#props,
|
|
351
|
+
columnBuilder: this.#props.columnBuilder.generatedAlwaysAs(expression),
|
|
352
|
+
});
|
|
353
|
+
}
|
|
354
|
+
generatedAlwaysAsIdentity() {
|
|
319
355
|
return new AlterTableModifyColumnBuilder({
|
|
320
356
|
...this.#props,
|
|
321
|
-
columnBuilder: this.#props.columnBuilder.
|
|
357
|
+
columnBuilder: this.#props.columnBuilder.generatedAlwaysAsIdentity(),
|
|
322
358
|
});
|
|
323
359
|
}
|
|
324
|
-
|
|
360
|
+
generatedByDefaultAsIdentity() {
|
|
325
361
|
return new AlterTableModifyColumnBuilder({
|
|
326
362
|
...this.#props,
|
|
327
|
-
columnBuilder: this.#props.columnBuilder.
|
|
363
|
+
columnBuilder: this.#props.columnBuilder.generatedByDefaultAsIdentity(),
|
|
328
364
|
});
|
|
329
365
|
}
|
|
330
366
|
stored() {
|
|
@@ -66,6 +66,12 @@ export interface ColumnDefinitionBuilderInterface {
|
|
|
66
66
|
* Adds a `not null` constraint for the column.
|
|
67
67
|
*/
|
|
68
68
|
notNull(): ColumnDefinitionBuilderInterface;
|
|
69
|
+
/**
|
|
70
|
+
* Adds a `unsigned` modifier for the column.
|
|
71
|
+
*
|
|
72
|
+
* This only works on some dialects like MySQL.
|
|
73
|
+
*/
|
|
74
|
+
unsigned(): ColumnDefinitionBuilderInterface;
|
|
69
75
|
/**
|
|
70
76
|
* Adds a default value constraint for the column.
|
|
71
77
|
*
|
|
@@ -87,11 +93,13 @@ export interface ColumnDefinitionBuilderInterface {
|
|
|
87
93
|
* ```ts
|
|
88
94
|
* db.schema
|
|
89
95
|
* .createTable('pet')
|
|
90
|
-
* .addColumn('number_of_legs', 'integer', (col) =>
|
|
96
|
+
* .addColumn('number_of_legs', 'integer', (col) =>
|
|
97
|
+
* col.check(db.raw('number_of_legs < 5'))
|
|
98
|
+
* )
|
|
91
99
|
* .execute()
|
|
92
100
|
* ```
|
|
93
101
|
*/
|
|
94
|
-
check(
|
|
102
|
+
check(expression: AnyRawBuilder): ColumnDefinitionBuilderInterface;
|
|
95
103
|
/**
|
|
96
104
|
* Makes the column a generated column using a `generated always as` statement.
|
|
97
105
|
*
|
|
@@ -101,12 +109,20 @@ export interface ColumnDefinitionBuilderInterface {
|
|
|
101
109
|
* db.schema
|
|
102
110
|
* .createTable('person')
|
|
103
111
|
* .addColumn('full_name', 'varchar(255)',
|
|
104
|
-
* (col) => col.generatedAlwaysAs("concat(first_name, ' ', last_name)")
|
|
112
|
+
* (col) => col.generatedAlwaysAs(db.raw("concat(first_name, ' ', last_name)"))
|
|
105
113
|
* )
|
|
106
114
|
* .execute()
|
|
107
115
|
* ```
|
|
108
116
|
*/
|
|
109
|
-
generatedAlwaysAs(
|
|
117
|
+
generatedAlwaysAs(expression: AnyRawBuilder): ColumnDefinitionBuilderInterface;
|
|
118
|
+
/**
|
|
119
|
+
* Adds the `generated always as identity` specifier on supported dialects.
|
|
120
|
+
*/
|
|
121
|
+
generatedAlwaysAsIdentity(): ColumnDefinitionBuilderInterface;
|
|
122
|
+
/**
|
|
123
|
+
* Adds the `generated by default as identity` specifier on supported dialects.
|
|
124
|
+
*/
|
|
125
|
+
generatedByDefaultAsIdentity(): ColumnDefinitionBuilderInterface;
|
|
110
126
|
/**
|
|
111
127
|
* Makes a generated column stored instead of virtual. This method can only
|
|
112
128
|
* be used with {@link generatedAlwaysAs}
|
|
@@ -189,6 +205,12 @@ export declare class ColumnDefinitionBuilder implements ColumnDefinitionBuilderI
|
|
|
189
205
|
* Adds a `not null` constraint for the column.
|
|
190
206
|
*/
|
|
191
207
|
notNull(): ColumnDefinitionBuilder;
|
|
208
|
+
/**
|
|
209
|
+
* Adds a `unsigned` modifier for the column.
|
|
210
|
+
*
|
|
211
|
+
* This only works on some dialects like MySQL.
|
|
212
|
+
*/
|
|
213
|
+
unsigned(): ColumnDefinitionBuilder;
|
|
192
214
|
/**
|
|
193
215
|
* Adds a default value constraint for the column.
|
|
194
216
|
*
|
|
@@ -210,11 +232,13 @@ export declare class ColumnDefinitionBuilder implements ColumnDefinitionBuilderI
|
|
|
210
232
|
* ```ts
|
|
211
233
|
* db.schema
|
|
212
234
|
* .createTable('pet')
|
|
213
|
-
* .addColumn('number_of_legs', 'integer', (col) =>
|
|
235
|
+
* .addColumn('number_of_legs', 'integer', (col) =>
|
|
236
|
+
* col.check(db.raw('number_of_legs < 5'))
|
|
237
|
+
* )
|
|
214
238
|
* .execute()
|
|
215
239
|
* ```
|
|
216
240
|
*/
|
|
217
|
-
check(
|
|
241
|
+
check(expression: AnyRawBuilder): ColumnDefinitionBuilder;
|
|
218
242
|
/**
|
|
219
243
|
* Makes the column a generated column using a `generated always as` statement.
|
|
220
244
|
*
|
|
@@ -224,12 +248,20 @@ export declare class ColumnDefinitionBuilder implements ColumnDefinitionBuilderI
|
|
|
224
248
|
* db.schema
|
|
225
249
|
* .createTable('person')
|
|
226
250
|
* .addColumn('full_name', 'varchar(255)',
|
|
227
|
-
* (col) => col.generatedAlwaysAs("concat(first_name, ' ', last_name)")
|
|
251
|
+
* (col) => col.generatedAlwaysAs(db.raw("concat(first_name, ' ', last_name)"))
|
|
228
252
|
* )
|
|
229
253
|
* .execute()
|
|
230
254
|
* ```
|
|
231
255
|
*/
|
|
232
|
-
generatedAlwaysAs(
|
|
256
|
+
generatedAlwaysAs(expression: AnyRawBuilder): ColumnDefinitionBuilder;
|
|
257
|
+
/**
|
|
258
|
+
* Adds the `generated always as identity` specifier on supported dialects.
|
|
259
|
+
*/
|
|
260
|
+
generatedAlwaysAsIdentity(): ColumnDefinitionBuilder;
|
|
261
|
+
/**
|
|
262
|
+
* Adds the `generated by default as identity` specifier on supported dialects.
|
|
263
|
+
*/
|
|
264
|
+
generatedByDefaultAsIdentity(): ColumnDefinitionBuilder;
|
|
233
265
|
/**
|
|
234
266
|
* Makes a generated column stored instead of virtual. This method can only
|
|
235
267
|
* be used with {@link generatedAlwaysAs}
|
|
@@ -6,7 +6,7 @@ import { parseStringReference } from '../parser/reference-parser.js';
|
|
|
6
6
|
import { preventAwait } from '../util/prevent-await.js';
|
|
7
7
|
import { ColumnDefinitionNode } from '../operation-node/column-definition-node.js';
|
|
8
8
|
import { parseDefaultValueExpression, } from '../parser/default-value-parser.js';
|
|
9
|
-
import {
|
|
9
|
+
import { GeneratedNode } from '../operation-node/generated-node.js';
|
|
10
10
|
import { DefaultValueNode } from '../operation-node/default-value-node.js';
|
|
11
11
|
export class ColumnDefinitionBuilder {
|
|
12
12
|
#node;
|
|
@@ -50,29 +50,42 @@ export class ColumnDefinitionBuilder {
|
|
|
50
50
|
return new ColumnDefinitionBuilder(ColumnDefinitionNode.cloneWith(this.#node, { unique: true }));
|
|
51
51
|
}
|
|
52
52
|
notNull() {
|
|
53
|
-
return new ColumnDefinitionBuilder(ColumnDefinitionNode.cloneWith(this.#node, {
|
|
53
|
+
return new ColumnDefinitionBuilder(ColumnDefinitionNode.cloneWith(this.#node, { notNull: true }));
|
|
54
|
+
}
|
|
55
|
+
unsigned() {
|
|
56
|
+
return new ColumnDefinitionBuilder(ColumnDefinitionNode.cloneWith(this.#node, { unsigned: true }));
|
|
54
57
|
}
|
|
55
58
|
defaultTo(value) {
|
|
56
59
|
return new ColumnDefinitionBuilder(ColumnDefinitionNode.cloneWith(this.#node, {
|
|
57
60
|
defaultTo: DefaultValueNode.create(parseDefaultValueExpression(value)),
|
|
58
61
|
}));
|
|
59
62
|
}
|
|
60
|
-
check(
|
|
63
|
+
check(expression) {
|
|
64
|
+
return new ColumnDefinitionBuilder(ColumnDefinitionNode.cloneWith(this.#node, {
|
|
65
|
+
check: CheckConstraintNode.create(expression.toOperationNode()),
|
|
66
|
+
}));
|
|
67
|
+
}
|
|
68
|
+
generatedAlwaysAs(expression) {
|
|
69
|
+
return new ColumnDefinitionBuilder(ColumnDefinitionNode.cloneWith(this.#node, {
|
|
70
|
+
generated: GeneratedNode.createWithExpression(expression.toOperationNode()),
|
|
71
|
+
}));
|
|
72
|
+
}
|
|
73
|
+
generatedAlwaysAsIdentity() {
|
|
61
74
|
return new ColumnDefinitionBuilder(ColumnDefinitionNode.cloneWith(this.#node, {
|
|
62
|
-
|
|
75
|
+
generated: GeneratedNode.create({ identity: true, always: true }),
|
|
63
76
|
}));
|
|
64
77
|
}
|
|
65
|
-
|
|
78
|
+
generatedByDefaultAsIdentity() {
|
|
66
79
|
return new ColumnDefinitionBuilder(ColumnDefinitionNode.cloneWith(this.#node, {
|
|
67
|
-
|
|
80
|
+
generated: GeneratedNode.create({ identity: true, byDefault: true }),
|
|
68
81
|
}));
|
|
69
82
|
}
|
|
70
83
|
stored() {
|
|
71
|
-
if (!this.#node.
|
|
84
|
+
if (!this.#node.generated) {
|
|
72
85
|
throw new Error('stored() can only be called after generatedAlwaysAs');
|
|
73
86
|
}
|
|
74
87
|
return new ColumnDefinitionBuilder(ColumnDefinitionNode.cloneWith(this.#node, {
|
|
75
|
-
|
|
88
|
+
generated: GeneratedNode.cloneWith(this.#node.generated, {
|
|
76
89
|
stored: true,
|
|
77
90
|
}),
|
|
78
91
|
}));
|
|
@@ -4,6 +4,7 @@ import { CompiledQuery } from '../query-compiler/compiled-query.js';
|
|
|
4
4
|
import { Compilable } from '../util/compilable.js';
|
|
5
5
|
import { QueryExecutor } from '../query-executor/query-executor.js';
|
|
6
6
|
import { QueryId } from '../util/query-id.js';
|
|
7
|
+
import { AnyRawBuilder } from '../util/type-utils.js';
|
|
7
8
|
export declare class CreateIndexBuilder implements OperationNodeSource, Compilable {
|
|
8
9
|
#private;
|
|
9
10
|
constructor(props: CreateIndexBuilderProps);
|
|
@@ -36,11 +37,11 @@ export declare class CreateIndexBuilder implements OperationNodeSource, Compilab
|
|
|
36
37
|
* await db.schema
|
|
37
38
|
* .createIndex('person_first_name_index')
|
|
38
39
|
* .on('person')
|
|
39
|
-
* .expression('first_name COLLATE "fi_FI"')
|
|
40
|
+
* .expression(db.raw('first_name COLLATE "fi_FI"'))
|
|
40
41
|
* .execute()
|
|
41
42
|
* ```
|
|
42
43
|
*/
|
|
43
|
-
expression(expression:
|
|
44
|
+
expression(expression: AnyRawBuilder): CreateIndexBuilder;
|
|
44
45
|
/**
|
|
45
46
|
* Specifies the index type.
|
|
46
47
|
*/
|
|
@@ -67,7 +67,7 @@ export class CreateIndexBuilder {
|
|
|
67
67
|
* await db.schema
|
|
68
68
|
* .createIndex('person_first_name_index')
|
|
69
69
|
* .on('person')
|
|
70
|
-
* .expression('first_name COLLATE "fi_FI"')
|
|
70
|
+
* .expression(db.raw('first_name COLLATE "fi_FI"'))
|
|
71
71
|
* .execute()
|
|
72
72
|
* ```
|
|
73
73
|
*/
|
|
@@ -75,7 +75,7 @@ export class CreateIndexBuilder {
|
|
|
75
75
|
return new CreateIndexBuilder({
|
|
76
76
|
...this.#props,
|
|
77
77
|
createIndexNode: CreateIndexNode.cloneWith(this.#props.createIndexNode, {
|
|
78
|
-
expression:
|
|
78
|
+
expression: expression.toOperationNode(),
|
|
79
79
|
}),
|
|
80
80
|
});
|
|
81
81
|
}
|
|
@@ -7,6 +7,7 @@ import { ColumnDefinitionBuilder } from './column-definition-builder.js';
|
|
|
7
7
|
import { QueryId } from '../util/query-id.js';
|
|
8
8
|
import { ForeignKeyConstraintBuilder } from './foreign-key-constraint-builder.js';
|
|
9
9
|
import { DataTypeExpression } from '../parser/data-type-parser.js';
|
|
10
|
+
import { AnyRawBuilder } from '../util/type-utils.js';
|
|
10
11
|
/**
|
|
11
12
|
* This builder can be used to create a `create table` query.
|
|
12
13
|
*/
|
|
@@ -110,10 +111,10 @@ export declare class CreateTableBuilder<TB extends string, C extends string = ne
|
|
|
110
111
|
* ### Examples
|
|
111
112
|
*
|
|
112
113
|
* ```ts
|
|
113
|
-
* addCheckConstraint('check_legs', 'number_of_legs < 5')
|
|
114
|
+
* addCheckConstraint('check_legs', db.raw('number_of_legs < 5'))
|
|
114
115
|
* ```
|
|
115
116
|
*/
|
|
116
|
-
addCheckConstraint(constraintName: string, checkExpression:
|
|
117
|
+
addCheckConstraint(constraintName: string, checkExpression: AnyRawBuilder): CreateTableBuilder<TB, C>;
|
|
117
118
|
/**
|
|
118
119
|
* Adds a foreign key constraint.
|
|
119
120
|
*
|
|
@@ -153,13 +153,13 @@ export class CreateTableBuilder {
|
|
|
153
153
|
* ### Examples
|
|
154
154
|
*
|
|
155
155
|
* ```ts
|
|
156
|
-
* addCheckConstraint('check_legs', 'number_of_legs < 5')
|
|
156
|
+
* addCheckConstraint('check_legs', db.raw('number_of_legs < 5'))
|
|
157
157
|
* ```
|
|
158
158
|
*/
|
|
159
159
|
addCheckConstraint(constraintName, checkExpression) {
|
|
160
160
|
return new CreateTableBuilder({
|
|
161
161
|
...this.#props,
|
|
162
|
-
createTableNode: CreateTableNode.cloneWithConstraint(this.#props.createTableNode, CheckConstraintNode.create(checkExpression, constraintName)),
|
|
162
|
+
createTableNode: CreateTableNode.cloneWithConstraint(this.#props.createTableNode, CheckConstraintNode.create(checkExpression.toOperationNode(), constraintName)),
|
|
163
163
|
});
|
|
164
164
|
}
|
|
165
165
|
/**
|
|
@@ -39,12 +39,11 @@ export declare type ValueType<T> = T[keyof T];
|
|
|
39
39
|
* // Row == Person & Movie
|
|
40
40
|
* ```
|
|
41
41
|
*/
|
|
42
|
-
export declare type RowType<DB, TB extends keyof DB> =
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) extends (k: infer I) => void ? I : never;
|
|
42
|
+
export declare type RowType<DB, TB extends keyof DB> = {
|
|
43
|
+
[C in AnyColumn<DB, TB>]: {
|
|
44
|
+
[T in TB]: C extends keyof DB[T] ? DB[T][C] : never;
|
|
45
|
+
}[TB];
|
|
46
|
+
};
|
|
48
47
|
/**
|
|
49
48
|
* Given a database type and a union of table names in that db, returns
|
|
50
49
|
* a union type with all possible column names.
|
|
@@ -79,6 +78,12 @@ declare type UnionToIntersection<U> = (U extends any ? (k: U) => void : never) e
|
|
|
79
78
|
export declare type AnyColumn<DB, TB extends keyof DB> = {
|
|
80
79
|
[T in TB]: keyof DB[T];
|
|
81
80
|
}[TB] & string;
|
|
81
|
+
/**
|
|
82
|
+
* Extracts a column type.
|
|
83
|
+
*/
|
|
84
|
+
export declare type ExtractColumnType<DB, TB extends keyof DB, C> = {
|
|
85
|
+
[T in TB]: C extends keyof DB[T] ? DB[T][C] : never;
|
|
86
|
+
}[TB];
|
|
82
87
|
/**
|
|
83
88
|
* Given a database type and a union of table names in that db, returns
|
|
84
89
|
* a union type with all possible `table`.`column` combinations.
|
|
@@ -146,4 +151,3 @@ export declare type UnknownRow = Record<string, unknown>;
|
|
|
146
151
|
export declare type Nullable<T> = {
|
|
147
152
|
[P in keyof T]: T[P] | null;
|
|
148
153
|
};
|
|
149
|
-
export {};
|
package/package.json
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kysely",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.14.1",
|
|
4
4
|
"description": "Type safe SQL query builder",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "git://github.com/koskimas/kysely.git"
|
|
8
8
|
},
|
|
9
9
|
"engines": {
|
|
10
|
-
"node": ">=
|
|
10
|
+
"node": ">=14.0.0"
|
|
11
11
|
},
|
|
12
12
|
"main": "dist/cjs/index.js",
|
|
13
13
|
"module": "dist/esm/index.js",
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { OperationNode } from './operation-node.js';
|
|
2
|
-
import { RawNode } from './raw-node.js';
|
|
3
|
-
export declare type GeneratedAlwaysAsNodeParams = Omit<GeneratedAlwaysAsNode, 'kind' | 'expression'>;
|
|
4
|
-
export interface GeneratedAlwaysAsNode extends OperationNode {
|
|
5
|
-
readonly kind: 'GeneratedAlwaysAsNode';
|
|
6
|
-
readonly expression: RawNode;
|
|
7
|
-
readonly stored?: boolean;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export declare const GeneratedAlwaysAsNode: Readonly<{
|
|
13
|
-
is(node: OperationNode): node is GeneratedAlwaysAsNode;
|
|
14
|
-
create(expression: string): GeneratedAlwaysAsNode;
|
|
15
|
-
cloneWith(node: GeneratedAlwaysAsNode, params: GeneratedAlwaysAsNodeParams): GeneratedAlwaysAsNode;
|
|
16
|
-
}>;
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.GeneratedAlwaysAsNode = void 0;
|
|
4
|
-
const object_utils_js_1 = require("../util/object-utils.js");
|
|
5
|
-
const raw_node_js_1 = require("./raw-node.js");
|
|
6
|
-
/**
|
|
7
|
-
* @internal
|
|
8
|
-
*/
|
|
9
|
-
exports.GeneratedAlwaysAsNode = (0, object_utils_js_1.freeze)({
|
|
10
|
-
is(node) {
|
|
11
|
-
return node.kind === 'GeneratedAlwaysAsNode';
|
|
12
|
-
},
|
|
13
|
-
create(expression) {
|
|
14
|
-
return (0, object_utils_js_1.freeze)({
|
|
15
|
-
kind: 'GeneratedAlwaysAsNode',
|
|
16
|
-
expression: raw_node_js_1.RawNode.createWithSql(expression),
|
|
17
|
-
});
|
|
18
|
-
},
|
|
19
|
-
cloneWith(node, params) {
|
|
20
|
-
return (0, object_utils_js_1.freeze)({
|
|
21
|
-
...node,
|
|
22
|
-
...params,
|
|
23
|
-
});
|
|
24
|
-
},
|
|
25
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { OnConflictNode } from '../operation-node/on-conflict-node.js';
|
|
2
|
-
import { AnyColumn } from '../util/type-utils.js';
|
|
3
|
-
import { ParseContext } from './parse-context.js';
|
|
4
|
-
import { MutationObject } from './update-set-parser.js';
|
|
5
|
-
export declare type OnConflictConstraintTarget = {
|
|
6
|
-
constraint: string;
|
|
7
|
-
};
|
|
8
|
-
export declare type OnConflictTargetExpression<DB, TB extends keyof DB> = AnyColumn<DB, TB> | ReadonlyArray<AnyColumn<DB, TB>> | OnConflictConstraintTarget;
|
|
9
|
-
export declare function parseOnConflictDoNothing(target: OnConflictTargetExpression<any, any>): OnConflictNode;
|
|
10
|
-
export declare function parseOnConflictUpdate(ctx: ParseContext, target: OnConflictTargetExpression<any, any>, updates: MutationObject<any, any>): OnConflictNode;
|
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.parseOnConflictUpdate = exports.parseOnConflictDoNothing = void 0;
|
|
4
|
-
const identifier_node_js_1 = require("../operation-node/identifier-node.js");
|
|
5
|
-
const on_conflict_node_js_1 = require("../operation-node/on-conflict-node.js");
|
|
6
|
-
const object_utils_js_1 = require("../util/object-utils.js");
|
|
7
|
-
const reference_parser_js_1 = require("./reference-parser.js");
|
|
8
|
-
const update_set_parser_js_1 = require("./update-set-parser.js");
|
|
9
|
-
function parseOnConflictDoNothing(target) {
|
|
10
|
-
return on_conflict_node_js_1.OnConflictNode.create({
|
|
11
|
-
...parseConflictTarget(target),
|
|
12
|
-
doNothing: true,
|
|
13
|
-
});
|
|
14
|
-
}
|
|
15
|
-
exports.parseOnConflictDoNothing = parseOnConflictDoNothing;
|
|
16
|
-
function parseOnConflictUpdate(ctx, target, updates) {
|
|
17
|
-
return on_conflict_node_js_1.OnConflictNode.create({
|
|
18
|
-
...parseConflictTarget(target),
|
|
19
|
-
updates: (0, update_set_parser_js_1.parseUpdateObject)(ctx, updates),
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
exports.parseOnConflictUpdate = parseOnConflictUpdate;
|
|
23
|
-
function parseConflictTarget(target) {
|
|
24
|
-
if ((0, object_utils_js_1.isString)(target) || (0, object_utils_js_1.isReadonlyArray)(target)) {
|
|
25
|
-
return {
|
|
26
|
-
columns: (0, object_utils_js_1.asReadonlyArray)(target).map(reference_parser_js_1.parseColumnName),
|
|
27
|
-
};
|
|
28
|
-
}
|
|
29
|
-
if ((0, object_utils_js_1.isObject)(target) && !(0, object_utils_js_1.isReadonlyArray)(target)) {
|
|
30
|
-
return {
|
|
31
|
-
constraint: identifier_node_js_1.IdentifierNode.create(target.constraint),
|
|
32
|
-
};
|
|
33
|
-
}
|
|
34
|
-
throw new Error(`invalid on conflict target ${JSON.stringify(target)}`);
|
|
35
|
-
}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { OperationNode } from './operation-node.js';
|
|
2
|
-
import { RawNode } from './raw-node.js';
|
|
3
|
-
export declare type GeneratedAlwaysAsNodeParams = Omit<GeneratedAlwaysAsNode, 'kind' | 'expression'>;
|
|
4
|
-
export interface GeneratedAlwaysAsNode extends OperationNode {
|
|
5
|
-
readonly kind: 'GeneratedAlwaysAsNode';
|
|
6
|
-
readonly expression: RawNode;
|
|
7
|
-
readonly stored?: boolean;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* @internal
|
|
11
|
-
*/
|
|
12
|
-
export declare const GeneratedAlwaysAsNode: Readonly<{
|
|
13
|
-
is(node: OperationNode): node is GeneratedAlwaysAsNode;
|
|
14
|
-
create(expression: string): GeneratedAlwaysAsNode;
|
|
15
|
-
cloneWith(node: GeneratedAlwaysAsNode, params: GeneratedAlwaysAsNodeParams): GeneratedAlwaysAsNode;
|
|
16
|
-
}>;
|
|
@@ -1,22 +0,0 @@
|
|
|
1
|
-
import { freeze } from '../util/object-utils.js';
|
|
2
|
-
import { RawNode } from './raw-node.js';
|
|
3
|
-
/**
|
|
4
|
-
* @internal
|
|
5
|
-
*/
|
|
6
|
-
export const GeneratedAlwaysAsNode = freeze({
|
|
7
|
-
is(node) {
|
|
8
|
-
return node.kind === 'GeneratedAlwaysAsNode';
|
|
9
|
-
},
|
|
10
|
-
create(expression) {
|
|
11
|
-
return freeze({
|
|
12
|
-
kind: 'GeneratedAlwaysAsNode',
|
|
13
|
-
expression: RawNode.createWithSql(expression),
|
|
14
|
-
});
|
|
15
|
-
},
|
|
16
|
-
cloneWith(node, params) {
|
|
17
|
-
return freeze({
|
|
18
|
-
...node,
|
|
19
|
-
...params,
|
|
20
|
-
});
|
|
21
|
-
},
|
|
22
|
-
});
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
import { OnConflictNode } from '../operation-node/on-conflict-node.js';
|
|
2
|
-
import { AnyColumn } from '../util/type-utils.js';
|
|
3
|
-
import { ParseContext } from './parse-context.js';
|
|
4
|
-
import { MutationObject } from './update-set-parser.js';
|
|
5
|
-
export declare type OnConflictConstraintTarget = {
|
|
6
|
-
constraint: string;
|
|
7
|
-
};
|
|
8
|
-
export declare type OnConflictTargetExpression<DB, TB extends keyof DB> = AnyColumn<DB, TB> | ReadonlyArray<AnyColumn<DB, TB>> | OnConflictConstraintTarget;
|
|
9
|
-
export declare function parseOnConflictDoNothing(target: OnConflictTargetExpression<any, any>): OnConflictNode;
|
|
10
|
-
export declare function parseOnConflictUpdate(ctx: ParseContext, target: OnConflictTargetExpression<any, any>, updates: MutationObject<any, any>): OnConflictNode;
|