@riao/dbal 1.1.3 → 3.0.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 +5 -1
- package/builder/builder.d.ts +1 -46
- package/builder/builder.js +1 -125
- package/builder/builder.js.map +1 -1
- package/builder/index.d.ts +1 -0
- package/builder/index.js +3 -1
- package/builder/index.js.map +1 -1
- package/builder/sql-builder.d.ts +40 -0
- package/builder/sql-builder.js +114 -0
- package/builder/sql-builder.js.map +1 -0
- package/builder/statement-builder.d.ts +10 -0
- package/builder/statement-builder.js +24 -0
- package/builder/statement-builder.js.map +1 -0
- package/column/column-options.d.ts +1 -1
- package/comparison/comparison-aliases.d.ts +10 -0
- package/comparison/comparison-aliases.js +41 -0
- package/comparison/comparison-aliases.js.map +1 -0
- package/comparison/comparison-token.d.ts +17 -0
- package/comparison/comparison-token.js +16 -0
- package/comparison/comparison-token.js.map +1 -0
- package/comparison/comparison.d.ts +13 -0
- package/comparison/comparison.js +72 -0
- package/comparison/comparison.js.map +1 -0
- package/comparison/index.d.ts +4 -0
- package/comparison/index.js +25 -0
- package/comparison/index.js.map +1 -0
- package/comparison/is-comparison-token.d.ts +2 -0
- package/comparison/is-comparison-token.js +9 -0
- package/comparison/is-comparison-token.js.map +1 -0
- package/database/database.d.ts +0 -6
- package/database/database.js +1 -8
- package/database/database.js.map +1 -1
- package/ddl/ddl-builder.d.ts +7 -2
- package/ddl/ddl-builder.js +105 -91
- package/ddl/ddl-builder.js.map +1 -1
- package/ddl/ddl-repository.js +15 -14
- package/ddl/ddl-repository.js.map +1 -1
- package/dml/delete.d.ts +2 -2
- package/dml/group-by.d.ts +4 -0
- package/dml/group-by.js +3 -0
- package/dml/group-by.js.map +1 -0
- package/dml/index.d.ts +2 -2
- package/dml/index.js +2 -2
- package/dml/index.js.map +1 -1
- package/dml/insert.d.ts +7 -4
- package/dml/join.d.ts +3 -3
- package/dml/query-builder.d.ts +41 -20
- package/dml/query-builder.js +301 -172
- package/dml/query-builder.js.map +1 -1
- package/dml/query-repository.d.ts +7 -1
- package/dml/query-repository.js +66 -13
- package/dml/query-repository.js.map +1 -1
- package/dml/select.d.ts +9 -6
- package/dml/subquery.d.ts +5 -0
- package/dml/subquery.js +11 -0
- package/dml/subquery.js.map +1 -0
- package/dml/update.d.ts +2 -2
- package/expression/expression-token.d.ts +9 -0
- package/expression/expression-token.js +11 -0
- package/expression/expression-token.js.map +1 -0
- package/expression/expression.d.ts +6 -0
- package/expression/expression.js +3 -0
- package/expression/expression.js.map +1 -0
- package/expression/identifier.d.ts +7 -0
- package/expression/identifier.js +16 -0
- package/expression/identifier.js.map +1 -0
- package/expression/index.d.ts +5 -0
- package/expression/index.js +24 -0
- package/expression/index.js.map +1 -0
- package/expression/is-expression-token.d.ts +2 -0
- package/expression/is-expression-token.js +8 -0
- package/expression/is-expression-token.js.map +1 -0
- package/expression/key-val-expression.d.ts +7 -0
- package/expression/key-val-expression.js +3 -0
- package/expression/key-val-expression.js.map +1 -0
- package/expression/literal.d.ts +2 -0
- package/expression/literal.js +3 -0
- package/expression/literal.js.map +1 -0
- package/expression/logical.d.ts +18 -0
- package/expression/logical.js +31 -0
- package/expression/logical.js.map +1 -0
- package/expression/simple-expression.d.ts +5 -0
- package/expression/simple-expression.js +3 -0
- package/expression/simple-expression.js.map +1 -0
- package/functions/function-aliases.d.ts +3 -0
- package/functions/function-aliases.js +13 -0
- package/functions/function-aliases.js.map +1 -0
- package/functions/{function-interface.d.ts → function-token.d.ts} +8 -7
- package/functions/{function-interface.js → function-token.js} +3 -2
- package/functions/function-token.js.map +1 -0
- package/functions/functions.d.ts +3 -2
- package/functions/functions.js +15 -4
- package/functions/functions.js.map +1 -1
- package/functions/index.d.ts +4 -1
- package/functions/index.js +6 -1
- package/functions/index.js.map +1 -1
- package/functions/is-database-function.d.ts +8 -0
- package/functions/is-database-function.js +15 -0
- package/functions/is-database-function.js.map +1 -0
- package/index.d.ts +4 -0
- package/index.js +4 -0
- package/index.js.map +1 -1
- package/migration/create-migration-table.js +2 -1
- package/migration/create-migration-table.js.map +1 -1
- package/package.json +1 -1
- package/repository/repository-options.d.ts +0 -2
- package/repository/repository.d.ts +12 -3
- package/repository/repository.js +32 -1
- package/repository/repository.js.map +1 -1
- package/seed/auto-seed.js +16 -16
- package/seed/auto-seed.js.map +1 -1
- package/seed/create-seed-table.js +2 -1
- package/seed/create-seed-table.js.map +1 -1
- package/tokens/index.d.ts +1 -0
- package/tokens/index.js +6 -0
- package/tokens/index.js.map +1 -0
- package/dml/column-name.d.ts +0 -3
- package/dml/column-name.js +0 -12
- package/dml/column-name.js.map +0 -1
- package/dml/where.d.ts +0 -26
- package/dml/where.js +0 -67
- package/dml/where.js.map +0 -1
- package/functions/function-interface.js.map +0 -1
package/ddl/ddl-repository.js
CHANGED
|
@@ -23,6 +23,7 @@ class DataDefinitionRepository extends repository_1.Repository {
|
|
|
23
23
|
}
|
|
24
24
|
init(options) {
|
|
25
25
|
super.init(options);
|
|
26
|
+
this.isReady = true;
|
|
26
27
|
}
|
|
27
28
|
getDDLBuilder() {
|
|
28
29
|
return new this.ddlBuilderType();
|
|
@@ -34,7 +35,7 @@ class DataDefinitionRepository extends repository_1.Repository {
|
|
|
34
35
|
*/
|
|
35
36
|
createDatabase(options) {
|
|
36
37
|
return __awaiter(this, void 0, void 0, function* () {
|
|
37
|
-
yield this.
|
|
38
|
+
yield this.query(this.getDDLBuilder().createDatabase(options));
|
|
38
39
|
});
|
|
39
40
|
}
|
|
40
41
|
/**
|
|
@@ -44,7 +45,7 @@ class DataDefinitionRepository extends repository_1.Repository {
|
|
|
44
45
|
*/
|
|
45
46
|
createTable(options) {
|
|
46
47
|
return __awaiter(this, void 0, void 0, function* () {
|
|
47
|
-
yield this.
|
|
48
|
+
yield this.query(this.getDDLBuilder().createTable(options));
|
|
48
49
|
});
|
|
49
50
|
}
|
|
50
51
|
/**
|
|
@@ -54,7 +55,7 @@ class DataDefinitionRepository extends repository_1.Repository {
|
|
|
54
55
|
*/
|
|
55
56
|
createUser(options) {
|
|
56
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
57
|
-
yield this.
|
|
58
|
+
yield this.query(this.getDDLBuilder().createUser(options));
|
|
58
59
|
});
|
|
59
60
|
}
|
|
60
61
|
/**
|
|
@@ -71,7 +72,7 @@ class DataDefinitionRepository extends repository_1.Repository {
|
|
|
71
72
|
*/
|
|
72
73
|
grant(options) {
|
|
73
74
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
|
-
yield this.
|
|
75
|
+
yield this.query(this.getDDLBuilder().grant(options));
|
|
75
76
|
});
|
|
76
77
|
}
|
|
77
78
|
/**
|
|
@@ -81,7 +82,7 @@ class DataDefinitionRepository extends repository_1.Repository {
|
|
|
81
82
|
*/
|
|
82
83
|
addColumns(options) {
|
|
83
84
|
return __awaiter(this, void 0, void 0, function* () {
|
|
84
|
-
yield this.
|
|
85
|
+
yield this.query(this.getDDLBuilder().addColumns(options));
|
|
85
86
|
});
|
|
86
87
|
}
|
|
87
88
|
/**
|
|
@@ -91,7 +92,7 @@ class DataDefinitionRepository extends repository_1.Repository {
|
|
|
91
92
|
*/
|
|
92
93
|
addForeignKey(options) {
|
|
93
94
|
return __awaiter(this, void 0, void 0, function* () {
|
|
94
|
-
yield this.
|
|
95
|
+
yield this.query(this.getDDLBuilder().addForeignKey(options));
|
|
95
96
|
});
|
|
96
97
|
}
|
|
97
98
|
/**
|
|
@@ -101,7 +102,7 @@ class DataDefinitionRepository extends repository_1.Repository {
|
|
|
101
102
|
*/
|
|
102
103
|
changeColumn(options) {
|
|
103
104
|
return __awaiter(this, void 0, void 0, function* () {
|
|
104
|
-
yield this.
|
|
105
|
+
yield this.query(this.getDDLBuilder().changeColumn(options));
|
|
105
106
|
});
|
|
106
107
|
}
|
|
107
108
|
/**
|
|
@@ -111,7 +112,7 @@ class DataDefinitionRepository extends repository_1.Repository {
|
|
|
111
112
|
*/
|
|
112
113
|
dropColumn(options) {
|
|
113
114
|
return __awaiter(this, void 0, void 0, function* () {
|
|
114
|
-
yield this.
|
|
115
|
+
yield this.query(this.getDDLBuilder().dropColumn(options));
|
|
115
116
|
});
|
|
116
117
|
}
|
|
117
118
|
/**
|
|
@@ -121,7 +122,7 @@ class DataDefinitionRepository extends repository_1.Repository {
|
|
|
121
122
|
*/
|
|
122
123
|
dropForeignKey(options) {
|
|
123
124
|
return __awaiter(this, void 0, void 0, function* () {
|
|
124
|
-
yield this.
|
|
125
|
+
yield this.query(this.getDDLBuilder().dropForeignKey(options));
|
|
125
126
|
});
|
|
126
127
|
}
|
|
127
128
|
/**
|
|
@@ -131,7 +132,7 @@ class DataDefinitionRepository extends repository_1.Repository {
|
|
|
131
132
|
*/
|
|
132
133
|
renameTable(options) {
|
|
133
134
|
return __awaiter(this, void 0, void 0, function* () {
|
|
134
|
-
yield this.
|
|
135
|
+
yield this.query(this.getDDLBuilder().renameTable(options));
|
|
135
136
|
});
|
|
136
137
|
}
|
|
137
138
|
/**
|
|
@@ -141,7 +142,7 @@ class DataDefinitionRepository extends repository_1.Repository {
|
|
|
141
142
|
*/
|
|
142
143
|
dropDatabase(options) {
|
|
143
144
|
return __awaiter(this, void 0, void 0, function* () {
|
|
144
|
-
yield this.
|
|
145
|
+
yield this.query(this.getDDLBuilder().dropDatabase(options));
|
|
145
146
|
});
|
|
146
147
|
}
|
|
147
148
|
/**
|
|
@@ -151,7 +152,7 @@ class DataDefinitionRepository extends repository_1.Repository {
|
|
|
151
152
|
*/
|
|
152
153
|
dropTable(options) {
|
|
153
154
|
return __awaiter(this, void 0, void 0, function* () {
|
|
154
|
-
yield this.
|
|
155
|
+
yield this.query(this.getDDLBuilder().dropTable(options));
|
|
155
156
|
});
|
|
156
157
|
}
|
|
157
158
|
/**
|
|
@@ -161,7 +162,7 @@ class DataDefinitionRepository extends repository_1.Repository {
|
|
|
161
162
|
*/
|
|
162
163
|
dropUser(options) {
|
|
163
164
|
return __awaiter(this, void 0, void 0, function* () {
|
|
164
|
-
yield this.
|
|
165
|
+
yield this.query(this.getDDLBuilder().dropUser(options));
|
|
165
166
|
});
|
|
166
167
|
}
|
|
167
168
|
/**
|
|
@@ -171,7 +172,7 @@ class DataDefinitionRepository extends repository_1.Repository {
|
|
|
171
172
|
*/
|
|
172
173
|
truncate(options) {
|
|
173
174
|
return __awaiter(this, void 0, void 0, function* () {
|
|
174
|
-
yield this.
|
|
175
|
+
yield this.query(this.getDDLBuilder().truncate(options));
|
|
175
176
|
});
|
|
176
177
|
}
|
|
177
178
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ddl-repository.js","sourceRoot":"","sources":["../../../src/ddl/ddl-repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gCAgBgB;AAEhB,8CAA8E;AAQ9E;;GAEG;AACH,MAAa,wBAAyB,SAAQ,uBAAU;IAIvD,YAAmB,OAA6B;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAC;QAJN,mBAAc,GACvB,2BAAqB,CAAC;QAKtB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,CAAC;IAC9C,CAAC;IAEM,IAAI,CAAC,OAA0B;QACrC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrB,CAAC;IAEM,aAAa;QACnB,OAAO,IAAI,IAAI,CAAC,cAAc,EAAE,CAAC;IAClC,CAAC;IAED;;;;OAIG;IACU,cAAc,CAAC,OAA8B;;YACzD,MAAM,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"ddl-repository.js","sourceRoot":"","sources":["../../../src/ddl/ddl-repository.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,gCAgBgB;AAEhB,8CAA8E;AAQ9E;;GAEG;AACH,MAAa,wBAAyB,SAAQ,uBAAU;IAIvD,YAAmB,OAA6B;QAC/C,KAAK,CAAC,OAAO,CAAC,CAAC;QAJN,mBAAc,GACvB,2BAAqB,CAAC;QAKtB,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC,cAAc,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CAAC;QAC1D,CAAC;KAAA;CACD;AAvJD,4DAuJC"}
|
package/dml/delete.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
+
import { Expression } from '../expression';
|
|
1
2
|
import { DatabaseRecord } from '../record';
|
|
2
3
|
import { Join } from './join';
|
|
3
|
-
import { Where } from './where';
|
|
4
4
|
export interface DeleteOptions<T extends DatabaseRecord = DatabaseRecord> {
|
|
5
5
|
table?: string;
|
|
6
6
|
join?: Join[];
|
|
7
|
-
where:
|
|
7
|
+
where: Expression<T>;
|
|
8
8
|
}
|
package/dml/group-by.js
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"group-by.js","sourceRoot":"","sources":["../../../src/dml/group-by.ts"],"names":[],"mappings":""}
|
package/dml/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
export { DatabaseQueryBuilder } from './query-builder';
|
|
2
2
|
export { QueryRepository, QueryRepositoryOptions } from './query-repository';
|
|
3
|
-
export * from './column-name';
|
|
4
3
|
export * from './delete';
|
|
5
4
|
export * from './insert';
|
|
6
5
|
export * from './join';
|
|
6
|
+
export * from './group-by';
|
|
7
7
|
export * from './order-by';
|
|
8
8
|
export * from './select';
|
|
9
|
+
export * from './subquery';
|
|
9
10
|
export * from './update';
|
|
10
|
-
export * from './where';
|
package/dml/index.js
CHANGED
|
@@ -19,12 +19,12 @@ var query_builder_1 = require("./query-builder");
|
|
|
19
19
|
Object.defineProperty(exports, "DatabaseQueryBuilder", { enumerable: true, get: function () { return query_builder_1.DatabaseQueryBuilder; } });
|
|
20
20
|
var query_repository_1 = require("./query-repository");
|
|
21
21
|
Object.defineProperty(exports, "QueryRepository", { enumerable: true, get: function () { return query_repository_1.QueryRepository; } });
|
|
22
|
-
__exportStar(require("./column-name"), exports);
|
|
23
22
|
__exportStar(require("./delete"), exports);
|
|
24
23
|
__exportStar(require("./insert"), exports);
|
|
25
24
|
__exportStar(require("./join"), exports);
|
|
25
|
+
__exportStar(require("./group-by"), exports);
|
|
26
26
|
__exportStar(require("./order-by"), exports);
|
|
27
27
|
__exportStar(require("./select"), exports);
|
|
28
|
+
__exportStar(require("./subquery"), exports);
|
|
28
29
|
__exportStar(require("./update"), exports);
|
|
29
|
-
__exportStar(require("./where"), exports);
|
|
30
30
|
//# sourceMappingURL=index.js.map
|
package/dml/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dml/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAAuD;AAA9C,qHAAA,oBAAoB,OAAA;AAC7B,uDAA6E;AAApE,mHAAA,eAAe,OAAA;AAExB,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/dml/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;AAAA,iDAAuD;AAA9C,qHAAA,oBAAoB,OAAA;AAC7B,uDAA6E;AAApE,mHAAA,eAAe,OAAA;AAExB,2CAAyB;AACzB,2CAAyB;AACzB,yCAAuB;AACvB,6CAA2B;AAC3B,6CAA2B;AAC3B,2CAAyB;AACzB,6CAA2B;AAC3B,2CAAyB"}
|
package/dml/insert.d.ts
CHANGED
|
@@ -1,11 +1,14 @@
|
|
|
1
1
|
import { DatabaseRecord } from '../record';
|
|
2
|
-
export interface
|
|
2
|
+
export interface BaseInsertOptions<T extends DatabaseRecord = DatabaseRecord> {
|
|
3
3
|
table?: string;
|
|
4
|
-
records: Partial<T> | Partial<T>[];
|
|
5
4
|
ifNotExists?: boolean;
|
|
6
5
|
onDuplicateKeyUpdate?: Partial<T>;
|
|
7
6
|
primaryKey?: string;
|
|
8
7
|
}
|
|
9
|
-
export interface
|
|
10
|
-
records: Partial<T
|
|
8
|
+
export interface InsertOptions<T extends DatabaseRecord = DatabaseRecord> extends BaseInsertOptions<T> {
|
|
9
|
+
records: Partial<T> | Partial<T>[];
|
|
10
|
+
}
|
|
11
|
+
export interface InsertOneOptions<T extends DatabaseRecord = DatabaseRecord> extends BaseInsertOptions<T> {
|
|
12
|
+
record: Partial<T>;
|
|
13
|
+
ignoreReturnId?: boolean;
|
|
11
14
|
}
|
package/dml/join.d.ts
CHANGED
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Expression } from '../expression';
|
|
2
2
|
export interface BaseJoin {
|
|
3
3
|
table: string;
|
|
4
4
|
alias?: string;
|
|
5
5
|
}
|
|
6
6
|
export interface InnerCrossJoin extends BaseJoin {
|
|
7
7
|
type?: 'INNER' | 'CROSS';
|
|
8
|
-
on?:
|
|
8
|
+
on?: Expression;
|
|
9
9
|
}
|
|
10
10
|
export interface LeftRightJoin extends BaseJoin {
|
|
11
11
|
type?: 'LEFT' | 'RIGHT';
|
|
12
12
|
outer?: boolean;
|
|
13
|
-
on:
|
|
13
|
+
on: Expression;
|
|
14
14
|
}
|
|
15
15
|
export type Join = InnerCrossJoin | LeftRightJoin;
|
package/dml/query-builder.d.ts
CHANGED
|
@@ -1,51 +1,72 @@
|
|
|
1
1
|
import { InsertOptions } from './insert';
|
|
2
|
-
import { Where, WhereCondition } from './where';
|
|
3
2
|
import { SelectColumn, SelectQuery } from './select';
|
|
4
3
|
import { UpdateOptions } from './update';
|
|
5
4
|
import { DeleteOptions } from './delete';
|
|
6
|
-
import {
|
|
5
|
+
import { StatementBuilder } from '../builder/statement-builder';
|
|
6
|
+
import { GroupBy } from './group-by';
|
|
7
7
|
import { OrderBy } from './order-by';
|
|
8
8
|
import { Join } from './join';
|
|
9
|
-
|
|
9
|
+
import { ComparisonToken } from '../comparison';
|
|
10
|
+
import { Expression, LogicalToken } from '../expression';
|
|
11
|
+
import { DatabaseFunction } from '../functions/function-token';
|
|
12
|
+
import { Subquery } from './subquery';
|
|
13
|
+
import { KeyValExpression } from '../expression/key-val-expression';
|
|
14
|
+
export declare class DatabaseQueryBuilder extends StatementBuilder {
|
|
15
|
+
expression(expr: Expression | LogicalToken): void;
|
|
16
|
+
subquery(subquery: Subquery): void;
|
|
17
|
+
keyValueExpression(kv: KeyValExpression): this;
|
|
10
18
|
selectColumn(column: SelectColumn): this;
|
|
11
19
|
selectColumnList(columns?: SelectColumn[]): this;
|
|
12
20
|
selectFrom(from: string): this;
|
|
21
|
+
tableAlias(alias: string): this;
|
|
13
22
|
selectStatement(): this;
|
|
23
|
+
distinctStatement(): this;
|
|
14
24
|
selectTop(limit: number): this;
|
|
15
|
-
|
|
16
|
-
like(value:
|
|
17
|
-
lt(value:
|
|
18
|
-
lte(value:
|
|
19
|
-
gt(value:
|
|
20
|
-
gte(value:
|
|
21
|
-
notEqual(value:
|
|
25
|
+
equal(value: Expression): void;
|
|
26
|
+
like(value: Expression): void;
|
|
27
|
+
lt(value: Expression): void;
|
|
28
|
+
lte(value: Expression): void;
|
|
29
|
+
gt(value: Expression): void;
|
|
30
|
+
gte(value: Expression): void;
|
|
31
|
+
notEqual(value: Expression): void;
|
|
32
|
+
isNull(): void;
|
|
33
|
+
inArray(values: Expression[]): void;
|
|
34
|
+
between(a: Expression, b: Expression): void;
|
|
35
|
+
notNull(): void;
|
|
36
|
+
buildComparisonToken(condition: ComparisonToken): this;
|
|
22
37
|
and(): void;
|
|
23
38
|
or(): void;
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
riaoCondition(condition: WhereCondition): this;
|
|
28
|
-
whereClause(where: Where | Where[] | WhereCondition): this;
|
|
29
|
-
where(where: Where | Where[]): this;
|
|
39
|
+
not(value: Expression): void;
|
|
40
|
+
logical(token: LogicalToken): void;
|
|
41
|
+
where(where: Expression): this;
|
|
30
42
|
limit(nRecords: number): this;
|
|
43
|
+
groupBy(by: GroupBy): this;
|
|
31
44
|
orderBy(by: OrderBy): void;
|
|
32
45
|
select(query: SelectQuery): this;
|
|
33
46
|
join(join: Join): void;
|
|
34
47
|
insertIntoStatement(table: string): this;
|
|
35
|
-
insertColumnNames(record: Record<string,
|
|
36
|
-
insertOnDuplicateKeyUpdate(assignment: Record<string,
|
|
48
|
+
insertColumnNames(record: Record<string, Expression>): this;
|
|
49
|
+
insertOnDuplicateKeyUpdate(assignment: Record<string, Expression>): this;
|
|
37
50
|
insertIfNotExists(): this;
|
|
38
51
|
insertOutput(primaryKey: string): this;
|
|
39
52
|
insertReturning(primaryKey: string): this;
|
|
40
53
|
insert(options: InsertOptions): this;
|
|
41
54
|
updateStatement(table: string): this;
|
|
42
55
|
updateKeyValues(values: {
|
|
43
|
-
[key: string]:
|
|
56
|
+
[key: string]: Expression;
|
|
44
57
|
}): this;
|
|
45
58
|
updateSetStatement(values: {
|
|
46
|
-
[key: string]:
|
|
59
|
+
[key: string]: Expression;
|
|
47
60
|
}): this;
|
|
48
61
|
update(options: UpdateOptions): this;
|
|
49
62
|
deleteStatement(table: string): this;
|
|
50
63
|
delete(options: DeleteOptions): this;
|
|
64
|
+
/**
|
|
65
|
+
* Append a database function the query
|
|
66
|
+
*
|
|
67
|
+
* @param fn Database function token
|
|
68
|
+
*/
|
|
69
|
+
databaseFunction(fn: DatabaseFunction): this;
|
|
70
|
+
count(fn: DatabaseFunction): this;
|
|
71
|
+
currentTimestamp(fn: DatabaseFunction): this;
|
|
51
72
|
}
|