kysely 0.7.8 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +47 -8
- package/dist/cjs/dialect/mysql/mysql-adapter.js +6 -0
- package/dist/cjs/dialect/mysql/mysql-driver.js +5 -5
- package/dist/cjs/dialect/mysql/mysql-query-compiler.d.ts +0 -2
- package/dist/cjs/dialect/mysql/mysql-query-compiler.js +0 -29
- package/dist/cjs/dialect/postgres/postgres-driver.js +5 -5
- package/dist/cjs/operation-node/primitive-value-list-node.js +1 -1
- package/dist/cjs/parser/insert-values-parser.d.ts +1 -1
- package/dist/cjs/parser/join-parser.d.ts +6 -3
- package/dist/cjs/parser/table-parser.d.ts +18 -7
- package/dist/cjs/parser/update-set-parser.d.ts +1 -1
- package/dist/cjs/query-builder/function-builder.d.ts +6 -6
- package/dist/cjs/query-builder/function-builder.js +7 -7
- package/dist/cjs/query-builder/query-builder.d.ts +7 -7
- package/dist/cjs/query-compiler/compiled-query.d.ts +1 -1
- package/dist/cjs/query-compiler/default-query-compiler.d.ts +3 -2
- package/dist/cjs/query-compiler/default-query-compiler.js +21 -27
- package/dist/cjs/query-creator.d.ts +14 -11
- package/dist/cjs/query-creator.js +14 -11
- package/dist/cjs/raw-builder/raw-builder.d.ts +1 -1
- package/dist/cjs/raw-builder/raw-builder.js +6 -6
- package/dist/cjs/schema/alter-table-builder.d.ts +3 -0
- package/dist/cjs/schema/alter-table-builder.js +3 -0
- package/dist/cjs/schema/column-definition-builder.d.ts +14 -5
- package/dist/cjs/schema/create-table-builder.d.ts +55 -10
- package/dist/cjs/schema/create-table-builder.js +52 -13
- package/dist/cjs/schema/schema.d.ts +37 -2
- package/dist/cjs/schema/schema.js +36 -1
- package/dist/cjs/util/object-utils.d.ts +1 -0
- package/dist/cjs/util/object-utils.js +5 -1
- package/dist/cjs/util/type-utils.d.ts +3 -0
- package/dist/esm/dialect/mysql/mysql-adapter.js +6 -0
- package/dist/esm/dialect/mysql/mysql-driver.js +5 -5
- package/dist/esm/dialect/mysql/mysql-query-compiler.d.ts +0 -2
- package/dist/esm/dialect/mysql/mysql-query-compiler.js +0 -29
- package/dist/esm/dialect/postgres/postgres-driver.js +5 -5
- package/dist/esm/operation-node/primitive-value-list-node.js +1 -1
- package/dist/esm/parser/insert-values-parser.d.ts +1 -1
- package/dist/esm/parser/join-parser.d.ts +6 -3
- package/dist/esm/parser/table-parser.d.ts +18 -7
- package/dist/esm/parser/update-set-parser.d.ts +1 -1
- package/dist/esm/query-builder/function-builder.d.ts +6 -6
- package/dist/esm/query-builder/function-builder.js +7 -7
- package/dist/esm/query-builder/query-builder.d.ts +7 -7
- package/dist/esm/query-compiler/compiled-query.d.ts +1 -1
- package/dist/esm/query-compiler/default-query-compiler.d.ts +3 -2
- package/dist/esm/query-compiler/default-query-compiler.js +21 -27
- package/dist/esm/query-creator.d.ts +14 -11
- package/dist/esm/query-creator.js +14 -11
- package/dist/esm/raw-builder/raw-builder.d.ts +1 -1
- package/dist/esm/raw-builder/raw-builder.js +6 -6
- package/dist/esm/schema/alter-table-builder.d.ts +3 -0
- package/dist/esm/schema/alter-table-builder.js +3 -0
- package/dist/esm/schema/column-definition-builder.d.ts +14 -5
- package/dist/esm/schema/create-table-builder.d.ts +55 -10
- package/dist/esm/schema/create-table-builder.js +53 -14
- package/dist/esm/schema/schema.d.ts +37 -2
- package/dist/esm/schema/schema.js +36 -1
- package/dist/esm/util/object-utils.d.ts +1 -0
- package/dist/esm/util/object-utils.js +3 -0
- package/dist/esm/util/type-utils.d.ts +3 -0
- package/package.json +7 -7
|
@@ -7,7 +7,10 @@ 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
|
-
|
|
10
|
+
/**
|
|
11
|
+
* This builder can be used to create a `create table` query.
|
|
12
|
+
*/
|
|
13
|
+
export declare class CreateTableBuilder<TB extends string, C extends string = never> implements OperationNodeSource, Compilable {
|
|
11
14
|
#private;
|
|
12
15
|
constructor(props: CreateTableBuilderProps);
|
|
13
16
|
/**
|
|
@@ -15,7 +18,7 @@ export declare class CreateTableBuilder implements OperationNodeSource, Compilab
|
|
|
15
18
|
*
|
|
16
19
|
* If the table already exists, no error is thrown if this method has been called.
|
|
17
20
|
*/
|
|
18
|
-
ifNotExists(): CreateTableBuilder
|
|
21
|
+
ifNotExists(): CreateTableBuilder<TB, C>;
|
|
19
22
|
/**
|
|
20
23
|
* Adds a column to the table.
|
|
21
24
|
*
|
|
@@ -23,44 +26,86 @@ export declare class CreateTableBuilder implements OperationNodeSource, Compilab
|
|
|
23
26
|
* ```ts
|
|
24
27
|
* await db.schema
|
|
25
28
|
* .createTable('person')
|
|
26
|
-
* .addColumn('
|
|
29
|
+
* .addColumn('id', 'integer', (col) => col.increments().primaryKey()),
|
|
27
30
|
* .addColumn('first_name', 'varchar(50), (col) => col.notNull())
|
|
28
|
-
* .addColumn('
|
|
29
|
-
* .addColumn('numeric(8, 2)'
|
|
31
|
+
* .addColumn('last_name', 'varchar')
|
|
32
|
+
* .addColumn('bank_balance', 'numeric(8, 2)')
|
|
30
33
|
* .addColumn('data', db.raw('customtype'))
|
|
34
|
+
* .addColumn('parent_id', 'integer', (col) =>
|
|
35
|
+
* col.references('person.id').onDelete('cascade'))
|
|
36
|
+
* )
|
|
37
|
+
* ```
|
|
38
|
+
*
|
|
39
|
+
* With this method, it's once again good to remember that Kysely just builds the query
|
|
40
|
+
* that's as close to the structure of your builder method calls as possible, and doesn't
|
|
41
|
+
* provide the same API for all databses. For example, some databases like older MySQL
|
|
42
|
+
* don't support `references` statement in the column definition. Instead foreign key
|
|
43
|
+
* constraints need to be defined in at the level of the `create table` query. See
|
|
44
|
+
* the next example:
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* .addColumn('parent_id', 'integer')
|
|
49
|
+
* .addForeignKeyConstraint(
|
|
50
|
+
* 'person_parent_id_fk', ['parent_id'], 'person', ['id'],
|
|
51
|
+
* (cb) => cb.onDelete('cascade')
|
|
52
|
+
* )
|
|
53
|
+
* ```
|
|
54
|
+
*
|
|
55
|
+
* Another good example is that PostgreSQL doesn't support the `auto_increment`
|
|
56
|
+
* keyword and you need to define an autoincrementing column for example using
|
|
57
|
+
* `serial`:
|
|
58
|
+
*
|
|
59
|
+
* @example
|
|
60
|
+
* ```ts
|
|
61
|
+
* await db.schema
|
|
62
|
+
* .createTable('person')
|
|
63
|
+
* .addColumn('id', 'serial', (col) => col.primaryKey()),
|
|
31
64
|
* ```
|
|
32
65
|
*/
|
|
33
|
-
addColumn(columnName:
|
|
66
|
+
addColumn<CN extends string>(columnName: CN, dataType: DataTypeExpression, build?: ColumnBuilderCallback): CreateTableBuilder<TB, C | CN>;
|
|
34
67
|
/**
|
|
35
68
|
* Adds a primary key constraint for one or more columns.
|
|
36
69
|
*
|
|
70
|
+
* The constraint name can be anything you want, but it must be unique
|
|
71
|
+
* across the whole database.
|
|
72
|
+
*
|
|
37
73
|
* @example
|
|
38
74
|
* ```ts
|
|
39
75
|
* addPrimaryKeyConstraint('primary_key', ['first_name', 'last_name'])
|
|
40
76
|
* ```
|
|
41
77
|
*/
|
|
42
|
-
addPrimaryKeyConstraint(constraintName: string, columns:
|
|
78
|
+
addPrimaryKeyConstraint(constraintName: string, columns: C[]): CreateTableBuilder<TB, C>;
|
|
43
79
|
/**
|
|
44
80
|
* Adds a unique constraint for one or more columns.
|
|
45
81
|
*
|
|
82
|
+
* The constraint name can be anything you want, but it must be unique
|
|
83
|
+
* across the whole database.
|
|
84
|
+
*
|
|
46
85
|
* @example
|
|
47
86
|
* ```ts
|
|
48
87
|
* addUniqueConstraint('first_name_last_name_unique', ['first_name', 'last_name'])
|
|
49
88
|
* ```
|
|
50
89
|
*/
|
|
51
|
-
addUniqueConstraint(constraintName: string, columns:
|
|
90
|
+
addUniqueConstraint(constraintName: string, columns: C[]): CreateTableBuilder<TB, C>;
|
|
52
91
|
/**
|
|
53
92
|
* Adds a check constraint.
|
|
54
93
|
*
|
|
94
|
+
* The constraint name can be anything you want, but it must be unique
|
|
95
|
+
* across the whole database.
|
|
96
|
+
*
|
|
55
97
|
* @example
|
|
56
98
|
* ```ts
|
|
57
99
|
* addCheckConstraint('check_legs', 'number_of_legs < 5')
|
|
58
100
|
* ```
|
|
59
101
|
*/
|
|
60
|
-
addCheckConstraint(constraintName: string, checkExpression: string): CreateTableBuilder
|
|
102
|
+
addCheckConstraint(constraintName: string, checkExpression: string): CreateTableBuilder<TB, C>;
|
|
61
103
|
/**
|
|
62
104
|
* Adds a foreign key constraint.
|
|
63
105
|
*
|
|
106
|
+
* The constraint name can be anything you want, but it must be unique
|
|
107
|
+
* across the whole database.
|
|
108
|
+
*
|
|
64
109
|
* @example
|
|
65
110
|
* ```ts
|
|
66
111
|
* addForeignKeyConstraint(
|
|
@@ -82,7 +127,7 @@ export declare class CreateTableBuilder implements OperationNodeSource, Compilab
|
|
|
82
127
|
* )
|
|
83
128
|
* ```
|
|
84
129
|
*/
|
|
85
|
-
addForeignKeyConstraint(constraintName: string, columns:
|
|
130
|
+
addForeignKeyConstraint(constraintName: string, columns: C[], targetTable: string, targetColumns: string[], build?: ForeignKeyConstraintBuilderCallback): CreateTableBuilder<TB, C>;
|
|
86
131
|
toOperationNode(): CreateTableNode;
|
|
87
132
|
compile(): CompiledQuery;
|
|
88
133
|
execute(): Promise<void>;
|
|
@@ -2,12 +2,15 @@ import { ColumnDefinitionNode } from '../operation-node/column-definition-node.j
|
|
|
2
2
|
import { CreateTableNode } from '../operation-node/create-table-node.js';
|
|
3
3
|
import { preventAwait } from '../util/prevent-await.js';
|
|
4
4
|
import { ColumnDefinitionBuilder } from './column-definition-builder.js';
|
|
5
|
-
import { freeze } from '../util/object-utils.js';
|
|
5
|
+
import { freeze, noop } from '../util/object-utils.js';
|
|
6
6
|
import { ForeignKeyConstraintNode } from '../operation-node/foreign-key-constraint-node.js';
|
|
7
7
|
import { ColumnNode } from '../operation-node/column-node.js';
|
|
8
8
|
import { TableNode } from '../operation-node/table-node.js';
|
|
9
9
|
import { ForeignKeyConstraintBuilder } from './foreign-key-constraint-builder.js';
|
|
10
10
|
import { parseDataTypeExpression, } from '../parser/data-type-parser.js';
|
|
11
|
+
/**
|
|
12
|
+
* This builder can be used to create a `create table` query.
|
|
13
|
+
*/
|
|
11
14
|
export class CreateTableBuilder {
|
|
12
15
|
#props;
|
|
13
16
|
constructor(props) {
|
|
@@ -31,18 +34,45 @@ export class CreateTableBuilder {
|
|
|
31
34
|
* ```ts
|
|
32
35
|
* await db.schema
|
|
33
36
|
* .createTable('person')
|
|
34
|
-
* .addColumn('
|
|
37
|
+
* .addColumn('id', 'integer', (col) => col.increments().primaryKey()),
|
|
35
38
|
* .addColumn('first_name', 'varchar(50), (col) => col.notNull())
|
|
36
|
-
* .addColumn('
|
|
37
|
-
* .addColumn('numeric(8, 2)'
|
|
39
|
+
* .addColumn('last_name', 'varchar')
|
|
40
|
+
* .addColumn('bank_balance', 'numeric(8, 2)')
|
|
38
41
|
* .addColumn('data', db.raw('customtype'))
|
|
42
|
+
* .addColumn('parent_id', 'integer', (col) =>
|
|
43
|
+
* col.references('person.id').onDelete('cascade'))
|
|
44
|
+
* )
|
|
45
|
+
* ```
|
|
46
|
+
*
|
|
47
|
+
* With this method, it's once again good to remember that Kysely just builds the query
|
|
48
|
+
* that's as close to the structure of your builder method calls as possible, and doesn't
|
|
49
|
+
* provide the same API for all databses. For example, some databases like older MySQL
|
|
50
|
+
* don't support `references` statement in the column definition. Instead foreign key
|
|
51
|
+
* constraints need to be defined in at the level of the `create table` query. See
|
|
52
|
+
* the next example:
|
|
53
|
+
*
|
|
54
|
+
* @example
|
|
55
|
+
* ```ts
|
|
56
|
+
* .addColumn('parent_id', 'integer')
|
|
57
|
+
* .addForeignKeyConstraint(
|
|
58
|
+
* 'person_parent_id_fk', ['parent_id'], 'person', ['id'],
|
|
59
|
+
* (cb) => cb.onDelete('cascade')
|
|
60
|
+
* )
|
|
61
|
+
* ```
|
|
62
|
+
*
|
|
63
|
+
* Another good example is that PostgreSQL doesn't support the `auto_increment`
|
|
64
|
+
* keyword and you need to define an autoincrementing column for example using
|
|
65
|
+
* `serial`:
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```ts
|
|
69
|
+
* await db.schema
|
|
70
|
+
* .createTable('person')
|
|
71
|
+
* .addColumn('id', 'serial', (col) => col.primaryKey()),
|
|
39
72
|
* ```
|
|
40
73
|
*/
|
|
41
|
-
addColumn(columnName, dataType, build) {
|
|
42
|
-
|
|
43
|
-
if (build) {
|
|
44
|
-
columnBuilder = build(columnBuilder);
|
|
45
|
-
}
|
|
74
|
+
addColumn(columnName, dataType, build = noop) {
|
|
75
|
+
const columnBuilder = build(new ColumnDefinitionBuilder(ColumnDefinitionNode.create(columnName, parseDataTypeExpression(dataType))));
|
|
46
76
|
return new CreateTableBuilder({
|
|
47
77
|
...this.#props,
|
|
48
78
|
createTableNode: CreateTableNode.cloneWithColumn(this.#props.createTableNode, columnBuilder.toOperationNode()),
|
|
@@ -51,6 +81,9 @@ export class CreateTableBuilder {
|
|
|
51
81
|
/**
|
|
52
82
|
* Adds a primary key constraint for one or more columns.
|
|
53
83
|
*
|
|
84
|
+
* The constraint name can be anything you want, but it must be unique
|
|
85
|
+
* across the whole database.
|
|
86
|
+
*
|
|
54
87
|
* @example
|
|
55
88
|
* ```ts
|
|
56
89
|
* addPrimaryKeyConstraint('primary_key', ['first_name', 'last_name'])
|
|
@@ -65,6 +98,9 @@ export class CreateTableBuilder {
|
|
|
65
98
|
/**
|
|
66
99
|
* Adds a unique constraint for one or more columns.
|
|
67
100
|
*
|
|
101
|
+
* The constraint name can be anything you want, but it must be unique
|
|
102
|
+
* across the whole database.
|
|
103
|
+
*
|
|
68
104
|
* @example
|
|
69
105
|
* ```ts
|
|
70
106
|
* addUniqueConstraint('first_name_last_name_unique', ['first_name', 'last_name'])
|
|
@@ -79,6 +115,9 @@ export class CreateTableBuilder {
|
|
|
79
115
|
/**
|
|
80
116
|
* Adds a check constraint.
|
|
81
117
|
*
|
|
118
|
+
* The constraint name can be anything you want, but it must be unique
|
|
119
|
+
* across the whole database.
|
|
120
|
+
*
|
|
82
121
|
* @example
|
|
83
122
|
* ```ts
|
|
84
123
|
* addCheckConstraint('check_legs', 'number_of_legs < 5')
|
|
@@ -93,6 +132,9 @@ export class CreateTableBuilder {
|
|
|
93
132
|
/**
|
|
94
133
|
* Adds a foreign key constraint.
|
|
95
134
|
*
|
|
135
|
+
* The constraint name can be anything you want, but it must be unique
|
|
136
|
+
* across the whole database.
|
|
137
|
+
*
|
|
96
138
|
* @example
|
|
97
139
|
* ```ts
|
|
98
140
|
* addForeignKeyConstraint(
|
|
@@ -114,11 +156,8 @@ export class CreateTableBuilder {
|
|
|
114
156
|
* )
|
|
115
157
|
* ```
|
|
116
158
|
*/
|
|
117
|
-
addForeignKeyConstraint(constraintName, columns, targetTable, targetColumns, build) {
|
|
118
|
-
|
|
119
|
-
if (build) {
|
|
120
|
-
builder = build(builder);
|
|
121
|
-
}
|
|
159
|
+
addForeignKeyConstraint(constraintName, columns, targetTable, targetColumns, build = noop) {
|
|
160
|
+
const builder = build(new ForeignKeyConstraintBuilder(ForeignKeyConstraintNode.create(columns.map(ColumnNode.create), TableNode.create(targetTable), targetColumns.map(ColumnNode.create), constraintName)));
|
|
122
161
|
return new CreateTableBuilder({
|
|
123
162
|
...this.#props,
|
|
124
163
|
createTableNode: CreateTableNode.cloneWithForeignKeyConstraint(this.#props.createTableNode, builder.toOperationNode()),
|
|
@@ -22,14 +22,49 @@ export declare class SchemaModule {
|
|
|
22
22
|
* ```ts
|
|
23
23
|
* await db.schema
|
|
24
24
|
* .createTable('person')
|
|
25
|
-
* .addColumn('id', '
|
|
25
|
+
* .addColumn('id', 'integer', col => col.primaryKey().increments())
|
|
26
26
|
* .addColumn('first_name', 'varchar', col => col.notNull())
|
|
27
27
|
* .addColumn('last_name', 'varchar', col => col.notNull())
|
|
28
28
|
* .addColumn('gender', 'varchar')
|
|
29
29
|
* .execute()
|
|
30
30
|
* ```
|
|
31
|
+
*
|
|
32
|
+
* @example
|
|
33
|
+
* This example creates a table with a foreign key. Not all database
|
|
34
|
+
* engines support column-level foreign key constraint definitions.
|
|
35
|
+
* For example if you are using MySQL 5.X see the next example after
|
|
36
|
+
* this one.
|
|
37
|
+
*
|
|
38
|
+
* ```ts
|
|
39
|
+
* await db.schema
|
|
40
|
+
* .createTable('pet')
|
|
41
|
+
* .addColumn('id', 'integer', col => col.primaryKey().increments())
|
|
42
|
+
* .addColumn('owner_id', 'integer', col => col
|
|
43
|
+
* .references('person.id')
|
|
44
|
+
* .onDelete('cascade')
|
|
45
|
+
* )
|
|
46
|
+
* .execute()
|
|
47
|
+
* ```
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* This example adds a foreign key constraint for a columns just
|
|
51
|
+
* like the previous example, but using a table-level statement.
|
|
52
|
+
* On MySQL 5.X you need to define foreign key constraints like
|
|
53
|
+
* this:
|
|
54
|
+
*
|
|
55
|
+
* ```ts
|
|
56
|
+
* await db.schema
|
|
57
|
+
* .createTable('pet')
|
|
58
|
+
* .addColumn('id', 'integer', col => col.primaryKey().increments())
|
|
59
|
+
* .addColumn('owner_id', 'integer')
|
|
60
|
+
* .addForeignKeyConstraint(
|
|
61
|
+
* 'pet_owner_id_foreign', ['owner_id'], 'person', ['id'],
|
|
62
|
+
* (constraint) => constraint.onDelete('cascade')
|
|
63
|
+
* )
|
|
64
|
+
* .execute()
|
|
65
|
+
* ```
|
|
31
66
|
*/
|
|
32
|
-
createTable(table:
|
|
67
|
+
createTable<TB extends string>(table: TB): CreateTableBuilder<TB, never>;
|
|
33
68
|
/**
|
|
34
69
|
* Drop a table.
|
|
35
70
|
*
|
|
@@ -33,12 +33,47 @@ export class SchemaModule {
|
|
|
33
33
|
* ```ts
|
|
34
34
|
* await db.schema
|
|
35
35
|
* .createTable('person')
|
|
36
|
-
* .addColumn('id', '
|
|
36
|
+
* .addColumn('id', 'integer', col => col.primaryKey().increments())
|
|
37
37
|
* .addColumn('first_name', 'varchar', col => col.notNull())
|
|
38
38
|
* .addColumn('last_name', 'varchar', col => col.notNull())
|
|
39
39
|
* .addColumn('gender', 'varchar')
|
|
40
40
|
* .execute()
|
|
41
41
|
* ```
|
|
42
|
+
*
|
|
43
|
+
* @example
|
|
44
|
+
* This example creates a table with a foreign key. Not all database
|
|
45
|
+
* engines support column-level foreign key constraint definitions.
|
|
46
|
+
* For example if you are using MySQL 5.X see the next example after
|
|
47
|
+
* this one.
|
|
48
|
+
*
|
|
49
|
+
* ```ts
|
|
50
|
+
* await db.schema
|
|
51
|
+
* .createTable('pet')
|
|
52
|
+
* .addColumn('id', 'integer', col => col.primaryKey().increments())
|
|
53
|
+
* .addColumn('owner_id', 'integer', col => col
|
|
54
|
+
* .references('person.id')
|
|
55
|
+
* .onDelete('cascade')
|
|
56
|
+
* )
|
|
57
|
+
* .execute()
|
|
58
|
+
* ```
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* This example adds a foreign key constraint for a columns just
|
|
62
|
+
* like the previous example, but using a table-level statement.
|
|
63
|
+
* On MySQL 5.X you need to define foreign key constraints like
|
|
64
|
+
* this:
|
|
65
|
+
*
|
|
66
|
+
* ```ts
|
|
67
|
+
* await db.schema
|
|
68
|
+
* .createTable('pet')
|
|
69
|
+
* .addColumn('id', 'integer', col => col.primaryKey().increments())
|
|
70
|
+
* .addColumn('owner_id', 'integer')
|
|
71
|
+
* .addForeignKeyConstraint(
|
|
72
|
+
* 'pet_owner_id_foreign', ['owner_id'], 'person', ['id'],
|
|
73
|
+
* (constraint) => constraint.onDelete('cascade')
|
|
74
|
+
* )
|
|
75
|
+
* .execute()
|
|
76
|
+
* ```
|
|
42
77
|
*/
|
|
43
78
|
createTable(table) {
|
|
44
79
|
return new CreateTableBuilder({
|
|
@@ -16,3 +16,4 @@ export declare function freeze<T>(obj: T): Readonly<T>;
|
|
|
16
16
|
export declare function asArray<T>(arg: T | T[]): T[];
|
|
17
17
|
export declare function asReadonlyArray<T>(arg: T | ReadonlyArray<T>): ReadonlyArray<T>;
|
|
18
18
|
export declare function isReadonlyArray(arg: unknown): arg is ReadonlyArray<unknown>;
|
|
19
|
+
export declare function noop<T>(obj: T): T;
|
|
@@ -154,4 +154,7 @@ export declare type ManyResultRowType<O> = O extends InsertResultTypeTag ? numbe
|
|
|
154
154
|
export declare type SingleResultRowType<O> = O extends InsertResultTypeTag ? number | undefined : O extends DeleteResultTypeTag ? number : O extends UpdateResultTypeTag ? number : O | undefined;
|
|
155
155
|
export declare type NonEmptySingleResultRowType<O> = O extends InsertResultTypeTag ? number : O extends DeleteResultTypeTag ? number : O extends UpdateResultTypeTag ? number : O;
|
|
156
156
|
export declare type UnknownRow = Record<string, unknown>;
|
|
157
|
+
export declare type Nullable<T> = {
|
|
158
|
+
[P in keyof T]: T[P] | null;
|
|
159
|
+
};
|
|
157
160
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "kysely",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "Type safe SQL query builder",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,7 +32,7 @@
|
|
|
32
32
|
"author": "Sami Koskimäki <sami@jakso.me>",
|
|
33
33
|
"license": "MIT",
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@types/node": "^16.
|
|
35
|
+
"@types/node": "^16.11.9"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
38
|
"@types/chai": "^4.2.22",
|
|
@@ -41,12 +41,12 @@
|
|
|
41
41
|
"@types/pg": "^8.6.1",
|
|
42
42
|
"chai": "^4.3.4",
|
|
43
43
|
"chai-subset": "^1.6.0",
|
|
44
|
-
"mocha": "^9.1.
|
|
45
|
-
"mysql2": "^2.3.
|
|
44
|
+
"mocha": "^9.1.3",
|
|
45
|
+
"mysql2": "^2.3.3",
|
|
46
46
|
"pg": "^8.7.1",
|
|
47
47
|
"prettier": "^2.4.1",
|
|
48
|
-
"tsd": "^0.
|
|
49
|
-
"typedoc": "^0.22.
|
|
50
|
-
"typescript": "4.
|
|
48
|
+
"tsd": "^0.19.0",
|
|
49
|
+
"typedoc": "^0.22.9",
|
|
50
|
+
"typescript": "4.5.2"
|
|
51
51
|
}
|
|
52
52
|
}
|