kysely 0.2.1 → 0.2.5
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 +8 -8
- package/lib/dialect/postgres/postgres-dialect.js +5 -4
- package/lib/index.d.ts +66 -2
- package/lib/index.js +66 -2
- package/lib/kysely.d.ts +15 -14
- package/lib/kysely.js +17 -16
- package/lib/migration/migration.js +4 -4
- package/lib/operation-node/add-column-node.d.ts +6 -19
- package/lib/operation-node/add-column-node.js +5 -14
- package/lib/operation-node/add-constraint-node.d.ts +13 -0
- package/lib/operation-node/add-constraint-node.js +18 -0
- package/lib/operation-node/alias-node.d.ts +4 -2
- package/lib/operation-node/alias-node.js +3 -0
- package/lib/operation-node/alter-column-node.d.ts +24 -0
- package/lib/operation-node/alter-column-node.js +25 -0
- package/lib/operation-node/alter-table-node.d.ts +30 -0
- package/lib/operation-node/alter-table-node.js +25 -0
- package/lib/operation-node/and-node.d.ts +3 -0
- package/lib/operation-node/and-node.js +3 -0
- package/lib/operation-node/check-constraint-node.d.ts +6 -1
- package/lib/operation-node/check-constraint-node.js +6 -1
- package/lib/operation-node/column-definition-node.d.ts +29 -0
- package/lib/operation-node/column-definition-node.js +30 -0
- package/lib/operation-node/column-node.d.ts +3 -0
- package/lib/operation-node/column-node.js +3 -0
- package/lib/operation-node/column-update-node.d.ts +3 -0
- package/lib/operation-node/column-update-node.js +3 -0
- package/lib/operation-node/common-table-expression-node.d.ts +3 -0
- package/lib/operation-node/common-table-expression-node.js +3 -0
- package/lib/operation-node/constraint-node.d.ts +5 -0
- package/lib/operation-node/constraint-node.js +2 -0
- package/lib/operation-node/create-index-node.d.ts +3 -0
- package/lib/operation-node/create-index-node.js +3 -0
- package/lib/operation-node/create-schema-node.d.ts +3 -0
- package/lib/operation-node/create-schema-node.js +3 -0
- package/lib/operation-node/create-table-node.d.ts +12 -12
- package/lib/operation-node/create-table-node.js +30 -12
- package/lib/operation-node/data-type-node.d.ts +3 -0
- package/lib/operation-node/data-type-node.js +3 -0
- package/lib/operation-node/delete-query-node.d.ts +3 -0
- package/lib/operation-node/delete-query-node.js +3 -0
- package/lib/operation-node/drop-column-node.d.ts +13 -0
- package/lib/operation-node/drop-column-node.js +19 -0
- package/lib/operation-node/drop-constraint-node.d.ts +13 -0
- package/lib/operation-node/drop-constraint-node.js +19 -0
- package/lib/operation-node/drop-index-node.d.ts +3 -0
- package/lib/operation-node/drop-index-node.js +3 -0
- package/lib/operation-node/drop-schema-node.d.ts +3 -0
- package/lib/operation-node/drop-schema-node.js +3 -0
- package/lib/operation-node/drop-table-node.d.ts +5 -2
- package/lib/operation-node/drop-table-node.js +3 -0
- package/lib/operation-node/filter-node.d.ts +3 -0
- package/lib/operation-node/filter-node.js +3 -0
- package/lib/operation-node/foreign-key-constraint-node.d.ts +18 -0
- package/lib/operation-node/foreign-key-constraint-node.js +22 -0
- package/lib/operation-node/from-node.d.ts +3 -0
- package/lib/operation-node/from-node.js +3 -0
- package/lib/operation-node/group-by-item-node.d.ts +3 -0
- package/lib/operation-node/group-by-item-node.js +3 -0
- package/lib/operation-node/group-by-node.d.ts +3 -0
- package/lib/operation-node/group-by-node.js +3 -0
- package/lib/operation-node/having-node.d.ts +3 -0
- package/lib/operation-node/having-node.js +3 -0
- package/lib/operation-node/identifier-node.d.ts +3 -0
- package/lib/operation-node/identifier-node.js +3 -0
- package/lib/operation-node/insert-query-node.d.ts +3 -0
- package/lib/operation-node/insert-query-node.js +3 -0
- package/lib/operation-node/join-node.d.ts +3 -0
- package/lib/operation-node/join-node.js +3 -0
- package/lib/operation-node/limit-node.d.ts +3 -0
- package/lib/operation-node/limit-node.js +3 -0
- package/lib/operation-node/list-node.d.ts +3 -0
- package/lib/operation-node/list-node.js +3 -0
- package/lib/operation-node/offset-node.d.ts +3 -0
- package/lib/operation-node/offset-node.js +3 -0
- package/lib/operation-node/on-conflict-node.d.ts +3 -0
- package/lib/operation-node/on-conflict-node.js +3 -0
- package/lib/operation-node/operation-node-transformer.d.ts +20 -4
- package/lib/operation-node/operation-node-transformer.js +86 -12
- package/lib/operation-node/operation-node-visitor.d.ts +20 -4
- package/lib/operation-node/operation-node-visitor.js +75 -5
- package/lib/operation-node/operation-node.d.ts +1 -1
- package/lib/operation-node/operator-node.d.ts +3 -0
- package/lib/operation-node/operator-node.js +3 -0
- package/lib/operation-node/or-node.d.ts +3 -0
- package/lib/operation-node/or-node.js +3 -0
- package/lib/operation-node/order-by-item-node.d.ts +3 -0
- package/lib/operation-node/order-by-item-node.js +3 -0
- package/lib/operation-node/order-by-node.d.ts +3 -0
- package/lib/operation-node/order-by-node.js +3 -0
- package/lib/operation-node/parens-node.d.ts +3 -0
- package/lib/operation-node/parens-node.js +3 -0
- package/lib/operation-node/primary-constraint-node.d.ts +15 -0
- package/lib/operation-node/primary-constraint-node.js +21 -0
- package/lib/operation-node/primitive-value-list-node.d.ts +3 -0
- package/lib/operation-node/primitive-value-list-node.js +3 -0
- package/lib/operation-node/query-node.d.ts +3 -0
- package/lib/operation-node/query-node.js +3 -0
- package/lib/operation-node/raw-node.d.ts +3 -0
- package/lib/operation-node/raw-node.js +3 -0
- package/lib/operation-node/reference-node.d.ts +3 -0
- package/lib/operation-node/reference-node.js +3 -0
- package/lib/operation-node/references-node.d.ts +5 -2
- package/lib/operation-node/references-node.js +5 -2
- package/lib/operation-node/rename-column-node.d.ts +14 -0
- package/lib/operation-node/rename-column-node.js +20 -0
- package/lib/operation-node/returning-node.d.ts +3 -0
- package/lib/operation-node/returning-node.js +3 -0
- package/lib/operation-node/select-all-node.d.ts +3 -0
- package/lib/operation-node/select-all-node.js +3 -0
- package/lib/operation-node/select-query-node.d.ts +3 -0
- package/lib/operation-node/select-query-node.js +3 -0
- package/lib/operation-node/selection-node.d.ts +3 -0
- package/lib/operation-node/selection-node.js +3 -0
- package/lib/operation-node/table-node.d.ts +3 -0
- package/lib/operation-node/table-node.js +3 -0
- package/lib/operation-node/unique-constraint-node.d.ts +15 -0
- package/lib/operation-node/unique-constraint-node.js +21 -0
- package/lib/operation-node/update-query-node.d.ts +3 -0
- package/lib/operation-node/update-query-node.js +3 -0
- package/lib/operation-node/value-list-node.d.ts +3 -0
- package/lib/operation-node/value-list-node.js +3 -0
- package/lib/operation-node/value-node.d.ts +3 -0
- package/lib/operation-node/value-node.js +3 -0
- package/lib/operation-node/where-node.d.ts +3 -0
- package/lib/operation-node/where-node.js +3 -0
- package/lib/operation-node/with-node.d.ts +3 -0
- package/lib/operation-node/with-node.js +3 -0
- package/lib/parser/with-parser.js +1 -1
- package/lib/plugin/camel-case/camel-case-plugin.d.ts +1 -1
- package/lib/plugin/camel-case/camel-case-plugin.js +1 -1
- package/lib/query-builder/query-builder.d.ts +9 -9
- package/lib/query-builder/query-builder.js +6 -6
- package/lib/query-builder/sub-query-builder.d.ts +1 -1
- package/lib/query-builder/sub-query-builder.js +1 -1
- package/lib/query-compiler/default-query-compiler.d.ts +21 -5
- package/lib/query-compiler/default-query-compiler.js +110 -10
- package/lib/query-compiler/query-compiler.d.ts +2 -1
- package/lib/query-creator.d.ts +2 -2
- package/lib/query-creator.js +1 -1
- package/lib/{util → query-executor}/query-executor.d.ts +0 -0
- package/lib/{util → query-executor}/query-executor.js +1 -1
- package/lib/raw-builder/raw-builder.d.ts +2 -2
- package/lib/raw-builder/raw-builder.js +4 -4
- package/lib/schema/alter-table-builder.d.ts +64 -0
- package/lib/schema/alter-table-builder.js +236 -0
- package/lib/schema/{add-column-builder.d.ts → column-definition-builder.d.ts} +25 -15
- package/lib/schema/column-definition-builder.js +66 -0
- package/lib/schema/create-index-builder.d.ts +2 -2
- package/lib/schema/create-index-builder.js +3 -3
- package/lib/schema/create-schema-builder.d.ts +2 -2
- package/lib/schema/create-schema-builder.js +3 -3
- package/lib/schema/create-table-builder.d.ts +28 -13
- package/lib/schema/create-table-builder.js +38 -18
- package/lib/schema/drop-index-builder.d.ts +2 -2
- package/lib/schema/drop-index-builder.js +3 -3
- package/lib/schema/drop-schema-builder.d.ts +2 -2
- package/lib/schema/drop-schema-builder.js +3 -3
- package/lib/schema/drop-table-builder.d.ts +2 -2
- package/lib/schema/drop-table-builder.js +3 -3
- package/lib/schema/schema.d.ts +19 -5
- package/lib/schema/schema.js +24 -4
- package/lib/transformers/with-schema-transformer.d.ts +2 -0
- package/lib/transformers/with-schema-transformer.js +3 -0
- package/lib/util/object-utils.d.ts +1 -0
- package/lib/util/object-utils.js +13 -1
- package/package.json +2 -2
- package/lib/operation-node/table-primary-constraint-node.d.ts +0 -10
- package/lib/operation-node/table-primary-constraint-node.js +0 -16
- package/lib/operation-node/table-unique-constraint-node.d.ts +0 -10
- package/lib/operation-node/table-unique-constraint-node.js +0 -16
- package/lib/schema/add-column-builder.js +0 -116
|
@@ -5,6 +5,9 @@ export interface AndNode extends OperationNode {
|
|
|
5
5
|
readonly left: FilterExpressionNode;
|
|
6
6
|
readonly right: FilterExpressionNode;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
8
11
|
export declare const andNode: Readonly<{
|
|
9
12
|
is(node: OperationNode): node is AndNode;
|
|
10
13
|
create(left: FilterExpressionNode, right: FilterExpressionNode): AndNode;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.andNode = void 0;
|
|
4
4
|
const object_utils_1 = require("../util/object-utils");
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
5
8
|
exports.andNode = object_utils_1.freeze({
|
|
6
9
|
is(node) {
|
|
7
10
|
return node.kind === 'AndNode';
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
import { OperationNode } from './operation-node';
|
|
2
2
|
import { RawNode } from './raw-node';
|
|
3
|
+
import { IdentifierNode } from './identifier-node';
|
|
3
4
|
export interface CheckConstraintNode extends OperationNode {
|
|
4
5
|
readonly kind: 'CheckConstraintNode';
|
|
5
6
|
readonly expression: RawNode;
|
|
7
|
+
readonly name?: IdentifierNode;
|
|
6
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
7
12
|
export declare const checkConstraintNode: Readonly<{
|
|
8
13
|
is(node: OperationNode): node is CheckConstraintNode;
|
|
9
|
-
create(expressionSql: string): CheckConstraintNode;
|
|
14
|
+
create(expressionSql: string, constraintName?: string | undefined): CheckConstraintNode;
|
|
10
15
|
}>;
|
|
@@ -3,14 +3,19 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.checkConstraintNode = void 0;
|
|
4
4
|
const object_utils_1 = require("../util/object-utils");
|
|
5
5
|
const raw_node_1 = require("./raw-node");
|
|
6
|
+
const identifier_node_1 = require("./identifier-node");
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
6
10
|
exports.checkConstraintNode = object_utils_1.freeze({
|
|
7
11
|
is(node) {
|
|
8
12
|
return node.kind === 'CheckConstraintNode';
|
|
9
13
|
},
|
|
10
|
-
create(expressionSql) {
|
|
14
|
+
create(expressionSql, constraintName) {
|
|
11
15
|
return object_utils_1.freeze({
|
|
12
16
|
kind: 'CheckConstraintNode',
|
|
13
17
|
expression: raw_node_1.rawNode.createWithSql(expressionSql),
|
|
18
|
+
name: constraintName ? identifier_node_1.identifierNode.create(constraintName) : undefined,
|
|
14
19
|
});
|
|
15
20
|
},
|
|
16
21
|
});
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { CheckConstraintNode } from './check-constraint-node';
|
|
2
|
+
import { ColumnNode } from './column-node';
|
|
3
|
+
import { DataTypeNode } from './data-type-node';
|
|
4
|
+
import { OperationNode } from './operation-node';
|
|
5
|
+
import { RawNode } from './raw-node';
|
|
6
|
+
import { ReferencesNode } from './references-node';
|
|
7
|
+
import { ValueNode } from './value-node';
|
|
8
|
+
export declare type ColumnDefinitionNodeParams = Omit<Partial<ColumnDefinitionNode>, 'kind'>;
|
|
9
|
+
export declare type ColumnDataTypeNode = DataTypeNode | RawNode;
|
|
10
|
+
export interface ColumnDefinitionNode extends OperationNode {
|
|
11
|
+
readonly kind: 'ColumnDefinitionNode';
|
|
12
|
+
readonly column: ColumnNode;
|
|
13
|
+
readonly dataType: ColumnDataTypeNode;
|
|
14
|
+
readonly references?: ReferencesNode;
|
|
15
|
+
readonly isPrimaryKey: boolean;
|
|
16
|
+
readonly isAutoIncrementing: boolean;
|
|
17
|
+
readonly isUnique: boolean;
|
|
18
|
+
readonly isNullable: boolean;
|
|
19
|
+
readonly defaultTo?: ValueNode | RawNode;
|
|
20
|
+
readonly check?: CheckConstraintNode;
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* @internal
|
|
24
|
+
*/
|
|
25
|
+
export declare const columnDefinitionNode: Readonly<{
|
|
26
|
+
is(node: OperationNode): node is ColumnDefinitionNode;
|
|
27
|
+
create(column: string, dataType: ColumnDataTypeNode): ColumnDefinitionNode;
|
|
28
|
+
cloneWith(node: ColumnDefinitionNode, params: ColumnDefinitionNodeParams): ColumnDefinitionNode;
|
|
29
|
+
}>;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.columnDefinitionNode = void 0;
|
|
4
|
+
const object_utils_1 = require("../util/object-utils");
|
|
5
|
+
const column_node_1 = require("./column-node");
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
exports.columnDefinitionNode = object_utils_1.freeze({
|
|
10
|
+
is(node) {
|
|
11
|
+
return node.kind === 'ColumnDefinitionNode';
|
|
12
|
+
},
|
|
13
|
+
create(column, dataType) {
|
|
14
|
+
return object_utils_1.freeze({
|
|
15
|
+
kind: 'ColumnDefinitionNode',
|
|
16
|
+
column: column_node_1.columnNode.create(column),
|
|
17
|
+
dataType,
|
|
18
|
+
isPrimaryKey: false,
|
|
19
|
+
isAutoIncrementing: false,
|
|
20
|
+
isUnique: false,
|
|
21
|
+
isNullable: true,
|
|
22
|
+
});
|
|
23
|
+
},
|
|
24
|
+
cloneWith(node, params) {
|
|
25
|
+
return object_utils_1.freeze({
|
|
26
|
+
...node,
|
|
27
|
+
...params,
|
|
28
|
+
});
|
|
29
|
+
},
|
|
30
|
+
});
|
|
@@ -4,6 +4,9 @@ export interface ColumnNode extends OperationNode {
|
|
|
4
4
|
readonly kind: 'ColumnNode';
|
|
5
5
|
readonly column: IdentifierNode;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
7
10
|
export declare const columnNode: Readonly<{
|
|
8
11
|
is(node: OperationNode): node is ColumnNode;
|
|
9
12
|
create(column: string): ColumnNode;
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.columnNode = void 0;
|
|
4
4
|
const object_utils_1 = require("../util/object-utils");
|
|
5
5
|
const identifier_node_1 = require("./identifier-node");
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
6
9
|
exports.columnNode = object_utils_1.freeze({
|
|
7
10
|
is(node) {
|
|
8
11
|
return node.kind === 'ColumnNode';
|
|
@@ -6,6 +6,9 @@ export interface ColumnUpdateNode extends OperationNode {
|
|
|
6
6
|
readonly column: ColumnNode;
|
|
7
7
|
readonly value: ValueExpressionNode;
|
|
8
8
|
}
|
|
9
|
+
/**
|
|
10
|
+
* @internal
|
|
11
|
+
*/
|
|
9
12
|
export declare const columnUpdateNode: Readonly<{
|
|
10
13
|
is(node: OperationNode): node is ColumnUpdateNode;
|
|
11
14
|
create(column: ColumnNode, value: ValueExpressionNode): ColumnUpdateNode;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.columnUpdateNode = void 0;
|
|
4
4
|
const object_utils_1 = require("../util/object-utils");
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
5
8
|
exports.columnUpdateNode = object_utils_1.freeze({
|
|
6
9
|
is(node) {
|
|
7
10
|
return node.kind === 'ColumnUpdateNode';
|
|
@@ -7,6 +7,9 @@ export interface CommonTableExpressionNode extends OperationNode {
|
|
|
7
7
|
readonly name: IdentifierNode;
|
|
8
8
|
readonly expression: QueryNode | RawNode;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
10
13
|
export declare const commonTableExpressionNode: Readonly<{
|
|
11
14
|
is(node: OperationNode): node is CommonTableExpressionNode;
|
|
12
15
|
create(name: IdentifierNode, expression: QueryNode | RawNode): CommonTableExpressionNode;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.commonTableExpressionNode = void 0;
|
|
4
4
|
const object_utils_1 = require("../util/object-utils");
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
5
8
|
exports.commonTableExpressionNode = object_utils_1.freeze({
|
|
6
9
|
is(node) {
|
|
7
10
|
return node.kind === 'CommonTableExpressionNode';
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
import { CheckConstraintNode } from "./check-constraint-node";
|
|
2
|
+
import { ForeignKeyConstraintNode } from "./foreign-key-constraint-node";
|
|
3
|
+
import { PrimaryKeyConstraintNode } from "./primary-constraint-node";
|
|
4
|
+
import { UniqueConstraintNode } from "./unique-constraint-node";
|
|
5
|
+
export declare type ConstraintNode = PrimaryKeyConstraintNode | UniqueConstraintNode | CheckConstraintNode | ForeignKeyConstraintNode;
|
|
@@ -14,6 +14,9 @@ export interface CreateIndexNode extends OperationNode {
|
|
|
14
14
|
readonly unique?: boolean;
|
|
15
15
|
readonly using?: RawNode;
|
|
16
16
|
}
|
|
17
|
+
/**
|
|
18
|
+
* @internal
|
|
19
|
+
*/
|
|
17
20
|
export declare const createIndexNode: Readonly<{
|
|
18
21
|
is(node: OperationNode): node is CreateIndexNode;
|
|
19
22
|
create(name: string): CreateIndexNode;
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createIndexNode = void 0;
|
|
4
4
|
const object_utils_1 = require("../util/object-utils");
|
|
5
5
|
const identifier_node_1 = require("./identifier-node");
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
6
9
|
exports.createIndexNode = object_utils_1.freeze({
|
|
7
10
|
is(node) {
|
|
8
11
|
return node.kind === 'CreateIndexNode';
|
|
@@ -7,6 +7,9 @@ export interface CreateSchemaNode extends OperationNode {
|
|
|
7
7
|
readonly schema: IdentifierNode;
|
|
8
8
|
readonly modifier?: CreateSchemaNodeModifier;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
10
13
|
export declare const createSchemaNode: Readonly<{
|
|
11
14
|
is(node: OperationNode): node is CreateSchemaNode;
|
|
12
15
|
create(schema: string, params?: CreateSchemaNodeParams | undefined): CreateSchemaNode;
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createSchemaNode = void 0;
|
|
4
4
|
const object_utils_1 = require("../util/object-utils");
|
|
5
5
|
const identifier_node_1 = require("./identifier-node");
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
6
9
|
exports.createSchemaNode = object_utils_1.freeze({
|
|
7
10
|
is(node) {
|
|
8
11
|
return node.kind === 'CreateSchemaNode';
|
|
@@ -1,25 +1,25 @@
|
|
|
1
|
-
import { CheckConstraintNode } from './check-constraint-node';
|
|
2
|
-
import { AddColumnNode } from './add-column-node';
|
|
3
1
|
import { OperationNode } from './operation-node';
|
|
4
2
|
import { TableNode } from './table-node';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
3
|
+
import { ConstraintNode } from './constraint-node';
|
|
4
|
+
import { ColumnDefinitionNode } from './column-definition-node';
|
|
7
5
|
export declare type CreateTableNodeModifier = 'IfNotExists';
|
|
8
6
|
export interface CreateTableNode extends OperationNode {
|
|
9
7
|
readonly kind: 'CreateTableNode';
|
|
10
8
|
readonly table: TableNode;
|
|
11
|
-
readonly columns: ReadonlyArray<
|
|
9
|
+
readonly columns: ReadonlyArray<ColumnDefinitionNode>;
|
|
12
10
|
readonly modifier?: CreateTableNodeModifier;
|
|
13
|
-
readonly
|
|
14
|
-
readonly uniqueConstraints?: ReadonlyArray<TableUniqueConstraintNode>;
|
|
15
|
-
readonly checkConstraints?: ReadonlyArray<CheckConstraintNode>;
|
|
11
|
+
readonly constraints?: ReadonlyArray<ConstraintNode>;
|
|
16
12
|
}
|
|
13
|
+
/**
|
|
14
|
+
* @internal
|
|
15
|
+
*/
|
|
17
16
|
export declare const createTableNode: Readonly<{
|
|
18
17
|
is(node: OperationNode): node is CreateTableNode;
|
|
19
18
|
create(table: TableNode): CreateTableNode;
|
|
20
|
-
cloneWithColumn(createTable: CreateTableNode, column:
|
|
19
|
+
cloneWithColumn(createTable: CreateTableNode, column: ColumnDefinitionNode): CreateTableNode;
|
|
21
20
|
cloneWithModifier(createTable: CreateTableNode, modifier: CreateTableNodeModifier): CreateTableNode;
|
|
22
|
-
cloneWithPrimaryKeyConstraint(createTable: CreateTableNode, columns: string[]): CreateTableNode;
|
|
23
|
-
cloneWithUniqueConstraint(createTable: CreateTableNode, columns: string[]): CreateTableNode;
|
|
24
|
-
cloneWithCheckConstraint(createTable: CreateTableNode, sql: string): CreateTableNode;
|
|
21
|
+
cloneWithPrimaryKeyConstraint(createTable: CreateTableNode, constraintName: string, columns: string[]): CreateTableNode;
|
|
22
|
+
cloneWithUniqueConstraint(createTable: CreateTableNode, constraintName: string, columns: string[]): CreateTableNode;
|
|
23
|
+
cloneWithCheckConstraint(createTable: CreateTableNode, constraintName: string, sql: string): CreateTableNode;
|
|
24
|
+
cloneWithForeignKeyConstraint(createTable: CreateTableNode, constraintName: string, sourceColumns: string[], targetTable: string, targetColumns: string[]): CreateTableNode;
|
|
25
25
|
}>;
|
|
@@ -3,8 +3,14 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.createTableNode = void 0;
|
|
4
4
|
const object_utils_1 = require("../util/object-utils");
|
|
5
5
|
const check_constraint_node_1 = require("./check-constraint-node");
|
|
6
|
-
const
|
|
7
|
-
const
|
|
6
|
+
const table_node_1 = require("./table-node");
|
|
7
|
+
const primary_constraint_node_1 = require("./primary-constraint-node");
|
|
8
|
+
const unique_constraint_node_1 = require("./unique-constraint-node");
|
|
9
|
+
const foreign_key_constraint_node_1 = require("./foreign-key-constraint-node");
|
|
10
|
+
const column_node_1 = require("./column-node");
|
|
11
|
+
/**
|
|
12
|
+
* @internal
|
|
13
|
+
*/
|
|
8
14
|
exports.createTableNode = object_utils_1.freeze({
|
|
9
15
|
is(node) {
|
|
10
16
|
return node.kind === 'CreateTableNode';
|
|
@@ -28,27 +34,39 @@ exports.createTableNode = object_utils_1.freeze({
|
|
|
28
34
|
modifier,
|
|
29
35
|
});
|
|
30
36
|
},
|
|
31
|
-
cloneWithPrimaryKeyConstraint(createTable, columns) {
|
|
37
|
+
cloneWithPrimaryKeyConstraint(createTable, constraintName, columns) {
|
|
38
|
+
const constraint = primary_constraint_node_1.primaryConstraintNode.create(columns, constraintName);
|
|
32
39
|
return object_utils_1.freeze({
|
|
33
40
|
...createTable,
|
|
34
|
-
|
|
41
|
+
constraints: createTable.constraints
|
|
42
|
+
? object_utils_1.freeze([...createTable.constraints, constraint])
|
|
43
|
+
: object_utils_1.freeze([constraint]),
|
|
44
|
+
});
|
|
45
|
+
},
|
|
46
|
+
cloneWithUniqueConstraint(createTable, constraintName, columns) {
|
|
47
|
+
const constraint = unique_constraint_node_1.uniqueConstraintNode.create(columns, constraintName);
|
|
48
|
+
return object_utils_1.freeze({
|
|
49
|
+
...createTable,
|
|
50
|
+
constraints: createTable.constraints
|
|
51
|
+
? object_utils_1.freeze([...createTable.constraints, constraint])
|
|
52
|
+
: object_utils_1.freeze([constraint]),
|
|
35
53
|
});
|
|
36
54
|
},
|
|
37
|
-
|
|
38
|
-
const constraint =
|
|
55
|
+
cloneWithCheckConstraint(createTable, constraintName, sql) {
|
|
56
|
+
const constraint = check_constraint_node_1.checkConstraintNode.create(sql, constraintName);
|
|
39
57
|
return object_utils_1.freeze({
|
|
40
58
|
...createTable,
|
|
41
|
-
|
|
42
|
-
? object_utils_1.freeze([...createTable.
|
|
59
|
+
constraints: createTable.constraints
|
|
60
|
+
? object_utils_1.freeze([...createTable.constraints, constraint])
|
|
43
61
|
: object_utils_1.freeze([constraint]),
|
|
44
62
|
});
|
|
45
63
|
},
|
|
46
|
-
|
|
47
|
-
const constraint =
|
|
64
|
+
cloneWithForeignKeyConstraint(createTable, constraintName, sourceColumns, targetTable, targetColumns) {
|
|
65
|
+
const constraint = foreign_key_constraint_node_1.foreignKeyConstraintNode.create(sourceColumns.map(column_node_1.columnNode.create), table_node_1.tableNode.create(targetTable), targetColumns.map(column_node_1.columnNode.create), constraintName);
|
|
48
66
|
return object_utils_1.freeze({
|
|
49
67
|
...createTable,
|
|
50
|
-
|
|
51
|
-
? object_utils_1.freeze([...createTable.
|
|
68
|
+
constraints: createTable.constraints
|
|
69
|
+
? object_utils_1.freeze([...createTable.constraints, constraint])
|
|
52
70
|
: object_utils_1.freeze([constraint]),
|
|
53
71
|
});
|
|
54
72
|
},
|
|
@@ -5,6 +5,9 @@ export interface DataTypeNode extends OperationNode {
|
|
|
5
5
|
readonly kind: 'DataTypeNode';
|
|
6
6
|
readonly dataType: ColumnDataType;
|
|
7
7
|
}
|
|
8
|
+
/**
|
|
9
|
+
* @internal
|
|
10
|
+
*/
|
|
8
11
|
export declare const dataTypeNode: Readonly<{
|
|
9
12
|
is(node: OperationNode): node is DataTypeNode;
|
|
10
13
|
create(dataType: ColumnDataType): DataTypeNode;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dataTypeNode = void 0;
|
|
4
4
|
const object_utils_1 = require("../util/object-utils");
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
5
8
|
exports.dataTypeNode = object_utils_1.freeze({
|
|
6
9
|
is(node) {
|
|
7
10
|
return node.kind === 'DataTypeNode';
|
|
@@ -13,6 +13,9 @@ export interface DeleteQueryNode extends OperationNode {
|
|
|
13
13
|
readonly returning?: ReturningNode;
|
|
14
14
|
readonly with?: WithNode;
|
|
15
15
|
}
|
|
16
|
+
/**
|
|
17
|
+
* @internal
|
|
18
|
+
*/
|
|
16
19
|
export declare const deleteQueryNode: Readonly<{
|
|
17
20
|
is(node: OperationNode): node is DeleteQueryNode;
|
|
18
21
|
create(fromItem: TableExpressionNode, withNode?: WithNode | undefined): DeleteQueryNode;
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.deleteQueryNode = void 0;
|
|
4
4
|
const object_utils_1 = require("../util/object-utils");
|
|
5
5
|
const from_node_1 = require("./from-node");
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
6
9
|
exports.deleteQueryNode = object_utils_1.freeze({
|
|
7
10
|
is(node) {
|
|
8
11
|
return node.kind === 'DeleteQueryNode';
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OperationNode } from './operation-node';
|
|
2
|
+
import { ColumnNode } from './column-node';
|
|
3
|
+
export interface DropColumnNode extends OperationNode {
|
|
4
|
+
readonly kind: 'DropColumnNode';
|
|
5
|
+
readonly column: ColumnNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare const dropColumnNode: Readonly<{
|
|
11
|
+
is(node: OperationNode): node is DropColumnNode;
|
|
12
|
+
create(column: string): DropColumnNode;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dropColumnNode = void 0;
|
|
4
|
+
const object_utils_1 = require("../util/object-utils");
|
|
5
|
+
const column_node_1 = require("./column-node");
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
exports.dropColumnNode = object_utils_1.freeze({
|
|
10
|
+
is(node) {
|
|
11
|
+
return node.kind === 'DropColumnNode';
|
|
12
|
+
},
|
|
13
|
+
create(column) {
|
|
14
|
+
return object_utils_1.freeze({
|
|
15
|
+
kind: 'DropColumnNode',
|
|
16
|
+
column: column_node_1.columnNode.create(column),
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { OperationNode } from './operation-node';
|
|
2
|
+
import { IdentifierNode } from './identifier-node';
|
|
3
|
+
export interface DropConstraintNode extends OperationNode {
|
|
4
|
+
readonly kind: 'DropConstraintNode';
|
|
5
|
+
readonly constraintName: IdentifierNode;
|
|
6
|
+
}
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
export declare const dropConstraintNode: Readonly<{
|
|
11
|
+
is(node: OperationNode): node is DropConstraintNode;
|
|
12
|
+
create(constraintName: string): DropConstraintNode;
|
|
13
|
+
}>;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.dropConstraintNode = void 0;
|
|
4
|
+
const object_utils_1 = require("../util/object-utils");
|
|
5
|
+
const identifier_node_1 = require("./identifier-node");
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
9
|
+
exports.dropConstraintNode = object_utils_1.freeze({
|
|
10
|
+
is(node) {
|
|
11
|
+
return node.kind === 'DropConstraintNode';
|
|
12
|
+
},
|
|
13
|
+
create(constraintName) {
|
|
14
|
+
return object_utils_1.freeze({
|
|
15
|
+
kind: 'DropConstraintNode',
|
|
16
|
+
constraintName: identifier_node_1.identifierNode.create(constraintName),
|
|
17
|
+
});
|
|
18
|
+
},
|
|
19
|
+
});
|
|
@@ -7,6 +7,9 @@ export interface DropIndexNode extends OperationNode {
|
|
|
7
7
|
readonly name: IdentifierNode;
|
|
8
8
|
readonly modifier?: DropIndexNodeModifier;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
10
13
|
export declare const dropIndexNode: Readonly<{
|
|
11
14
|
is(node: OperationNode): node is DropIndexNode;
|
|
12
15
|
create(name: string, params?: DropIndexNodeParams | undefined): DropIndexNode;
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.dropIndexNode = void 0;
|
|
4
4
|
const object_utils_1 = require("../util/object-utils");
|
|
5
5
|
const identifier_node_1 = require("./identifier-node");
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
6
9
|
exports.dropIndexNode = object_utils_1.freeze({
|
|
7
10
|
is(node) {
|
|
8
11
|
return node.kind === 'DropIndexNode';
|
|
@@ -7,6 +7,9 @@ export interface DropSchemaNode extends OperationNode {
|
|
|
7
7
|
readonly schema: IdentifierNode;
|
|
8
8
|
readonly modifier?: DropSchemaNodeModifier;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
10
13
|
export declare const dropSchemaNode: Readonly<{
|
|
11
14
|
is(node: OperationNode): node is DropSchemaNode;
|
|
12
15
|
create(schema: string, params?: DropSchemaNodeParams | undefined): DropSchemaNode;
|
|
@@ -3,6 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.dropSchemaNode = void 0;
|
|
4
4
|
const object_utils_1 = require("../util/object-utils");
|
|
5
5
|
const identifier_node_1 = require("./identifier-node");
|
|
6
|
+
/**
|
|
7
|
+
* @internal
|
|
8
|
+
*/
|
|
6
9
|
exports.dropSchemaNode = object_utils_1.freeze({
|
|
7
10
|
is(node) {
|
|
8
11
|
return node.kind === 'DropSchemaNode';
|
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { OperationNode } from './operation-node';
|
|
2
2
|
import { TableNode } from './table-node';
|
|
3
|
-
export declare type
|
|
3
|
+
export declare type DropTablexNodeParams = Omit<Partial<DropTableNode>, 'kind' | 'table'>;
|
|
4
4
|
export declare type DropTableNodeModifier = 'IfExists';
|
|
5
5
|
export interface DropTableNode extends OperationNode {
|
|
6
6
|
readonly kind: 'DropTableNode';
|
|
7
7
|
readonly table: TableNode;
|
|
8
8
|
readonly modifier?: DropTableNodeModifier;
|
|
9
9
|
}
|
|
10
|
+
/**
|
|
11
|
+
* @internal
|
|
12
|
+
*/
|
|
10
13
|
export declare const dropTableNode: Readonly<{
|
|
11
14
|
is(node: OperationNode): node is DropTableNode;
|
|
12
|
-
create(table: TableNode, params?:
|
|
15
|
+
create(table: TableNode, params?: DropTablexNodeParams | undefined): DropTableNode;
|
|
13
16
|
cloneWithModifier(dropIndex: DropTableNode, modifier: DropTableNodeModifier): DropTableNode;
|
|
14
17
|
}>;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.dropTableNode = void 0;
|
|
4
4
|
const object_utils_1 = require("../util/object-utils");
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
5
8
|
exports.dropTableNode = object_utils_1.freeze({
|
|
6
9
|
is(node) {
|
|
7
10
|
return node.kind === 'DropTableNode';
|
|
@@ -9,6 +9,9 @@ export interface FilterNode extends OperationNode {
|
|
|
9
9
|
readonly op: OperatorNode | RawNode;
|
|
10
10
|
readonly right: ValueExpressionNode;
|
|
11
11
|
}
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
12
15
|
export declare const filterNode: Readonly<{
|
|
13
16
|
is(node: OperationNode): node is FilterNode;
|
|
14
17
|
create(left: ReferenceExpressionNode | undefined, op: OperatorNode | RawNode, right: ValueExpressionNode): FilterNode;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.filterNode = void 0;
|
|
4
4
|
const object_utils_1 = require("../util/object-utils");
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
5
8
|
exports.filterNode = object_utils_1.freeze({
|
|
6
9
|
is(node) {
|
|
7
10
|
return node.kind === 'FilterNode';
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import { ColumnNode } from './column-node';
|
|
2
|
+
import { IdentifierNode } from './identifier-node';
|
|
3
|
+
import { OperationNode } from './operation-node';
|
|
4
|
+
import { ReferencesNode } from './references-node';
|
|
5
|
+
import { TableNode } from './table-node';
|
|
6
|
+
export interface ForeignKeyConstraintNode extends OperationNode {
|
|
7
|
+
readonly kind: 'ForeignKeyConstraintNode';
|
|
8
|
+
readonly columns: ReadonlyArray<ColumnNode>;
|
|
9
|
+
readonly references: ReferencesNode;
|
|
10
|
+
readonly name?: IdentifierNode;
|
|
11
|
+
}
|
|
12
|
+
/**
|
|
13
|
+
* @internal
|
|
14
|
+
*/
|
|
15
|
+
export declare const foreignKeyConstraintNode: Readonly<{
|
|
16
|
+
is(node: OperationNode): node is ForeignKeyConstraintNode;
|
|
17
|
+
create(sourceColumns: ReadonlyArray<ColumnNode>, targetTable: TableNode, targetColumns: ReadonlyArray<ColumnNode>, constraintName?: string | undefined): ForeignKeyConstraintNode;
|
|
18
|
+
}>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.foreignKeyConstraintNode = void 0;
|
|
4
|
+
const object_utils_1 = require("../util/object-utils");
|
|
5
|
+
const identifier_node_1 = require("./identifier-node");
|
|
6
|
+
const references_node_1 = require("./references-node");
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
10
|
+
exports.foreignKeyConstraintNode = object_utils_1.freeze({
|
|
11
|
+
is(node) {
|
|
12
|
+
return node.kind === 'ForeignKeyConstraintNode';
|
|
13
|
+
},
|
|
14
|
+
create(sourceColumns, targetTable, targetColumns, constraintName) {
|
|
15
|
+
return object_utils_1.freeze({
|
|
16
|
+
kind: 'ForeignKeyConstraintNode',
|
|
17
|
+
columns: sourceColumns,
|
|
18
|
+
references: references_node_1.referencesNode.create(targetTable, targetColumns),
|
|
19
|
+
name: constraintName ? identifier_node_1.identifierNode.create(constraintName) : undefined,
|
|
20
|
+
});
|
|
21
|
+
},
|
|
22
|
+
});
|
|
@@ -4,6 +4,9 @@ export interface FromNode extends OperationNode {
|
|
|
4
4
|
readonly kind: 'FromNode';
|
|
5
5
|
readonly froms: ReadonlyArray<TableExpressionNode>;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
7
10
|
export declare const fromNode: Readonly<{
|
|
8
11
|
is(node: OperationNode): node is FromNode;
|
|
9
12
|
create(froms: ReadonlyArray<TableExpressionNode>): FromNode;
|
|
@@ -2,6 +2,9 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.fromNode = void 0;
|
|
4
4
|
const object_utils_1 = require("../util/object-utils");
|
|
5
|
+
/**
|
|
6
|
+
* @internal
|
|
7
|
+
*/
|
|
5
8
|
exports.fromNode = object_utils_1.freeze({
|
|
6
9
|
is(node) {
|
|
7
10
|
return node.kind === 'FromNode';
|
|
@@ -4,6 +4,9 @@ export interface GroupByItemNode extends OperationNode {
|
|
|
4
4
|
readonly kind: 'GroupByItemNode';
|
|
5
5
|
readonly groupBy: ReferenceExpressionNode;
|
|
6
6
|
}
|
|
7
|
+
/**
|
|
8
|
+
* @internal
|
|
9
|
+
*/
|
|
7
10
|
export declare const groupByItemNode: Readonly<{
|
|
8
11
|
is(node: OperationNode): node is GroupByItemNode;
|
|
9
12
|
create(groupBy: ReferenceExpressionNode): GroupByItemNode;
|