taon-type-sql 21.0.12 → 21.0.15
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/browser/package.json +1 -1
- package/browser-prod/README.md +24 -0
- package/browser-prod/fesm2022/taon-type-sql-browser.mjs +859 -0
- package/browser-prod/fesm2022/taon-type-sql-browser.mjs.map +1 -0
- package/browser-prod/types/taon-type-sql-browser.d.ts +254 -0
- package/lib/build-info._auto-generated_.d.ts +5 -1
- package/lib/build-info._auto-generated_.js +6 -2
- package/lib/build-info._auto-generated_.js.map +1 -1
- package/lib/env/env.angular-node-app.d.ts +30 -30
- package/lib/env/env.angular-node-app.js +32 -32
- package/lib/env/env.angular-node-app.js.map +1 -1
- package/lib/env/env.docs-webapp.d.ts +30 -30
- package/lib/env/env.docs-webapp.js +32 -32
- package/lib/env/env.docs-webapp.js.map +1 -1
- package/lib/env/env.electron-app.d.ts +30 -30
- package/lib/env/env.electron-app.js +32 -32
- package/lib/env/env.electron-app.js.map +1 -1
- package/lib/env/env.mobile-app.d.ts +30 -30
- package/lib/env/env.mobile-app.js +32 -32
- package/lib/env/env.mobile-app.js.map +1 -1
- package/lib/env/env.npm-lib-and-cli-tool.d.ts +30 -30
- package/lib/env/env.npm-lib-and-cli-tool.js +32 -32
- package/lib/env/env.npm-lib-and-cli-tool.js.map +1 -1
- package/lib/env/env.vscode-plugin.d.ts +30 -30
- package/lib/env/env.vscode-plugin.js +32 -32
- package/lib/env/env.vscode-plugin.js.map +1 -1
- package/lib/index._auto-generated_.js +1 -1
- package/lib/index._auto-generated_.js.map +1 -1
- package/lib-prod/build-info._auto-generated_.d.ts +24 -0
- package/lib-prod/build-info._auto-generated_.js +30 -0
- package/lib-prod/build-info._auto-generated_.js.map +1 -0
- package/lib-prod/builder/column/basic-column.d.ts +8 -0
- package/lib-prod/builder/column/basic-column.js +15 -0
- package/lib-prod/builder/column/basic-column.js.map +1 -0
- package/lib-prod/builder/column/boolean-column.d.ts +9 -0
- package/lib-prod/builder/column/boolean-column.js +15 -0
- package/lib-prod/builder/column/boolean-column.js.map +1 -0
- package/lib-prod/builder/column/comparable-column.d.ts +18 -0
- package/lib-prod/builder/column/comparable-column.js +42 -0
- package/lib-prod/builder/column/comparable-column.js.map +1 -0
- package/lib-prod/builder/column/date-column.d.ts +9 -0
- package/lib-prod/builder/column/date-column.js +15 -0
- package/lib-prod/builder/column/date-column.js.map +1 -0
- package/lib-prod/builder/column/number-column.d.ts +10 -0
- package/lib-prod/builder/column/number-column.js +20 -0
- package/lib-prod/builder/column/number-column.js.map +1 -0
- package/lib-prod/builder/column/query-column.d.ts +18 -0
- package/lib-prod/builder/column/query-column.js +26 -0
- package/lib-prod/builder/column/query-column.js.map +1 -0
- package/lib-prod/builder/column/string-column.d.ts +17 -0
- package/lib-prod/builder/column/string-column.js +37 -0
- package/lib-prod/builder/column/string-column.js.map +1 -0
- package/lib-prod/builder/column/value-column.d.ts +15 -0
- package/lib-prod/builder/column/value-column.js +30 -0
- package/lib-prod/builder/column/value-column.js.map +1 -0
- package/lib-prod/builder/condition/query-column-condition.d.ts +13 -0
- package/lib-prod/builder/condition/query-column-condition.js +23 -0
- package/lib-prod/builder/condition/query-column-condition.js.map +1 -0
- package/lib-prod/builder/condition/query-condition-chain.d.ts +17 -0
- package/lib-prod/builder/condition/query-condition-chain.js +34 -0
- package/lib-prod/builder/condition/query-condition-chain.js.map +1 -0
- package/lib-prod/builder/condition/query-condition.d.ts +7 -0
- package/lib-prod/builder/condition/query-condition.js +7 -0
- package/lib-prod/builder/condition/query-condition.js.map +1 -0
- package/lib-prod/builder/condition/query-join-condition.d.ts +12 -0
- package/lib-prod/builder/condition/query-join-condition.js +23 -0
- package/lib-prod/builder/condition/query-join-condition.js.map +1 -0
- package/lib-prod/builder/helpers/generics-helper.d.ts +2 -0
- package/lib-prod/builder/helpers/generics-helper.js +7 -0
- package/lib-prod/builder/helpers/generics-helper.js.map +1 -0
- package/lib-prod/builder/helpers/internal-types.d.ts +15 -0
- package/lib-prod/builder/helpers/internal-types.js +4 -0
- package/lib-prod/builder/helpers/internal-types.js.map +1 -0
- package/lib-prod/builder/join/joined-tables-chain.d.ts +11 -0
- package/lib-prod/builder/join/joined-tables-chain.js +18 -0
- package/lib-prod/builder/join/joined-tables-chain.js.map +1 -0
- package/lib-prod/builder/join/joined-tables.d.ts +12 -0
- package/lib-prod/builder/join/joined-tables.js +25 -0
- package/lib-prod/builder/join/joined-tables.js.map +1 -0
- package/lib-prod/builder/other/query-ordering.d.ts +10 -0
- package/lib-prod/builder/other/query-ordering.js +21 -0
- package/lib-prod/builder/other/query-ordering.js.map +1 -0
- package/lib-prod/builder/query/select-query.d.ts +29 -0
- package/lib-prod/builder/query/select-query.js +54 -0
- package/lib-prod/builder/query/select-query.js.map +1 -0
- package/lib-prod/builder/query/table-condition-query.d.ts +16 -0
- package/lib-prod/builder/query/table-condition-query.js +31 -0
- package/lib-prod/builder/query/table-condition-query.js.map +1 -0
- package/lib-prod/builder/query/table-query.d.ts +23 -0
- package/lib-prod/builder/query/table-query.js +60 -0
- package/lib-prod/builder/query/table-query.js.map +1 -0
- package/lib-prod/builder/query-source.d.ts +14 -0
- package/lib-prod/builder/query-source.js +22 -0
- package/lib-prod/builder/query-source.js.map +1 -0
- package/lib-prod/builder/query-table.d.ts +15 -0
- package/lib-prod/builder/query-table.js +28 -0
- package/lib-prod/builder/query-table.js.map +1 -0
- package/lib-prod/client/mysql.d.ts +5 -0
- package/lib-prod/client/mysql.js +11 -0
- package/lib-prod/client/mysql.js.map +1 -0
- package/lib-prod/client/pg.d.ts +5 -0
- package/lib-prod/client/pg.js +11 -0
- package/lib-prod/client/pg.js.map +1 -0
- package/lib-prod/client/query-processor.d.ts +10 -0
- package/lib-prod/client/query-processor.js +73 -0
- package/lib-prod/client/query-processor.js.map +1 -0
- package/lib-prod/converter/param-converter.d.ts +2 -0
- package/lib-prod/converter/param-converter.js +31 -0
- package/lib-prod/converter/param-converter.js.map +1 -0
- package/lib-prod/converter/parameterized-converter.d.ts +5 -0
- package/lib-prod/converter/parameterized-converter.js +18 -0
- package/lib-prod/converter/parameterized-converter.js.map +1 -0
- package/lib-prod/converter/query-converter.d.ts +2 -0
- package/lib-prod/converter/query-converter.js +284 -0
- package/lib-prod/converter/query-converter.js.map +1 -0
- package/lib-prod/converter/result-converter.d.ts +2 -0
- package/lib-prod/converter/result-converter.js +89 -0
- package/lib-prod/converter/result-converter.js.map +1 -0
- package/lib-prod/converter/sql-converter.d.ts +2 -0
- package/lib-prod/converter/sql-converter.js +9 -0
- package/lib-prod/converter/sql-converter.js.map +1 -0
- package/lib-prod/converter/type-converter.d.ts +4 -0
- package/lib-prod/converter/type-converter.js +43 -0
- package/lib-prod/converter/type-converter.js.map +1 -0
- package/lib-prod/converter/types.d.ts +5 -0
- package/lib-prod/converter/types.js +3 -0
- package/lib-prod/converter/types.js.map +1 -0
- package/lib-prod/env/env.angular-node-app.d.ts +64 -0
- package/lib-prod/env/env.angular-node-app.js +71 -0
- package/lib-prod/env/env.angular-node-app.js.map +1 -0
- package/lib-prod/env/env.docs-webapp.d.ts +64 -0
- package/lib-prod/env/env.docs-webapp.js +71 -0
- package/lib-prod/env/env.docs-webapp.js.map +1 -0
- package/lib-prod/env/env.electron-app.d.ts +64 -0
- package/lib-prod/env/env.electron-app.js +71 -0
- package/lib-prod/env/env.electron-app.js.map +1 -0
- package/lib-prod/env/env.mobile-app.d.ts +64 -0
- package/lib-prod/env/env.mobile-app.js +71 -0
- package/lib-prod/env/env.mobile-app.js.map +1 -0
- package/lib-prod/env/env.npm-lib-and-cli-tool.d.ts +64 -0
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +71 -0
- package/lib-prod/env/env.npm-lib-and-cli-tool.js.map +1 -0
- package/lib-prod/env/env.vscode-plugin.d.ts +64 -0
- package/lib-prod/env/env.vscode-plugin.js +71 -0
- package/lib-prod/env/env.vscode-plugin.js.map +1 -0
- package/lib-prod/env/index.d.ts +6 -0
- package/lib-prod/env/index.js +23 -0
- package/lib-prod/env/index.js.map +1 -0
- package/lib-prod/index._auto-generated_.d.ts +0 -0
- package/lib-prod/index._auto-generated_.js +6 -0
- package/lib-prod/index._auto-generated_.js.map +1 -0
- package/lib-prod/index.d.ts +25 -0
- package/lib-prod/index.js +48 -0
- package/lib-prod/index.js.map +1 -0
- package/package.json +2 -1
- package/tmp-environment.json +8 -4
- package/websql/package.json +1 -1
- package/websql-prod/README.md +24 -0
- package/websql-prod/fesm2022/taon-type-sql-websql.mjs +859 -0
- package/websql-prod/fesm2022/taon-type-sql-websql.mjs.map +1 -0
- package/websql-prod/types/taon-type-sql-websql.d.ts +254 -0
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import QueryTable from "../query-table";
|
|
2
|
+
import QueryCondition from "./query-condition";
|
|
3
|
+
import GenericsHelper from "../helpers/generics-helper";
|
|
4
|
+
import { ConditionChainType } from "../helpers/internal-types";
|
|
5
|
+
export default class QueryConditionChain<Table extends QueryTable<any, any>> extends QueryCondition<Table> {
|
|
6
|
+
protected _$type: GenericsHelper<Table>;
|
|
7
|
+
protected _sibling: QueryCondition<any>;
|
|
8
|
+
protected _child: QueryCondition<any>;
|
|
9
|
+
protected _chainType: ConditionChainType;
|
|
10
|
+
protected _parenthesis: boolean;
|
|
11
|
+
protected _negation: boolean;
|
|
12
|
+
constructor(sibling: QueryCondition<any>, child: QueryCondition<any>, chainType: ConditionChainType);
|
|
13
|
+
$(): this;
|
|
14
|
+
not(): this;
|
|
15
|
+
and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
|
|
16
|
+
or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
|
|
17
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const query_condition_1 = require("./query-condition");
|
|
4
|
+
class QueryConditionChain extends query_condition_1.default {
|
|
5
|
+
_$type;
|
|
6
|
+
_sibling;
|
|
7
|
+
_child;
|
|
8
|
+
_chainType;
|
|
9
|
+
_parenthesis = false;
|
|
10
|
+
_negation = false;
|
|
11
|
+
constructor(sibling, child, chainType) {
|
|
12
|
+
super();
|
|
13
|
+
this._sibling = sibling;
|
|
14
|
+
this._child = child;
|
|
15
|
+
this._chainType = chainType;
|
|
16
|
+
}
|
|
17
|
+
// TODO how to call this
|
|
18
|
+
$() {
|
|
19
|
+
this._parenthesis = true;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
not() {
|
|
23
|
+
this._negation = true;
|
|
24
|
+
return this;
|
|
25
|
+
}
|
|
26
|
+
and(condition) {
|
|
27
|
+
return new QueryConditionChain(this, condition, 'and');
|
|
28
|
+
}
|
|
29
|
+
or(condition) {
|
|
30
|
+
return new QueryConditionChain(this, condition, 'or');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
exports.default = QueryConditionChain;
|
|
34
|
+
//# sourceMappingURL=query-condition-chain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-condition-chain.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;AACA,uDAA+C;AAK/C,MAAqB,mBAAwD,SAAQ,yBAAqB;IAE5F,MAAM,CAAwB;IAE9B,QAAQ,CAAsB;IAC9B,MAAM,CAAsB;IAC5B,UAAU,CAAqB;IAC/B,YAAY,GAAG,KAAK,CAAC;IACrB,SAAS,GAAG,KAAK,CAAC;IAE5B,YAAY,OAA4B,EAAE,KAA0B,EAAE,SAA6B;QAC/F,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAChC,CAAC;IAED,wBAAwB;IACxB,CAAC;QACG,IAAI,CAAC,YAAY,GAAG,IAAI,CAAC;QACzB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,GAAG;QACC,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,GAAG,CAAsC,SAAiC;QACtE,OAAO,IAAI,mBAAmB,CAAiB,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IAC3E,CAAC;IAED,EAAE,CAAsC,SAAiC;QACrE,OAAO,IAAI,mBAAmB,CAAiB,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IAC1E,CAAC;CACJ;AAnCD,sCAmCC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import QueryTable from "../query-table";
|
|
2
|
+
import QueryConditionChain from "./query-condition-chain";
|
|
3
|
+
declare abstract class QueryCondition<Table extends QueryTable<any, any>> {
|
|
4
|
+
abstract and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
|
|
5
|
+
abstract or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
|
|
6
|
+
}
|
|
7
|
+
export default QueryCondition;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// TODO I had to copy-paste the method implementations to every child class to avoid circular dependencies
|
|
4
|
+
class QueryCondition {
|
|
5
|
+
}
|
|
6
|
+
exports.default = QueryCondition;
|
|
7
|
+
//# sourceMappingURL=query-condition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-condition.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;AAGA,0GAA0G;AAE1G,MAAe,cAAc;CAK5B;AAED,kBAAe,cAAc,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import QueryColumn from "../column/query-column";
|
|
2
|
+
import QueryTable from "../query-table";
|
|
3
|
+
import QueryCondition from "./query-condition";
|
|
4
|
+
import QueryConditionChain from "./query-condition-chain";
|
|
5
|
+
export default class QueryJoinCondition<Table1 extends QueryTable<any, any>, Table2 extends QueryTable<any, any>, T> extends QueryCondition<Table1 | Table2> {
|
|
6
|
+
protected _column: QueryColumn<Table1, T>;
|
|
7
|
+
protected _type: string;
|
|
8
|
+
protected _otherColumn: QueryColumn<Table2, T>;
|
|
9
|
+
constructor(column: QueryColumn<Table1, T>, type: string, otherColumn: QueryColumn<Table2, T>);
|
|
10
|
+
and<Table3 extends QueryTable<any, any>>(condition: QueryCondition<Table3>): QueryConditionChain<Table1 | Table2 | Table3>;
|
|
11
|
+
or<Table3 extends QueryTable<any, any>>(condition: QueryCondition<Table3>): QueryConditionChain<Table1 | Table2 | Table3>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const query_condition_1 = require("./query-condition");
|
|
4
|
+
const query_condition_chain_1 = require("./query-condition-chain");
|
|
5
|
+
class QueryJoinCondition extends query_condition_1.default {
|
|
6
|
+
_column;
|
|
7
|
+
_type;
|
|
8
|
+
_otherColumn;
|
|
9
|
+
constructor(column, type, otherColumn) {
|
|
10
|
+
super();
|
|
11
|
+
this._column = column;
|
|
12
|
+
this._type = type;
|
|
13
|
+
this._otherColumn = otherColumn;
|
|
14
|
+
}
|
|
15
|
+
and(condition) {
|
|
16
|
+
return new query_condition_chain_1.default(this, condition, 'and');
|
|
17
|
+
}
|
|
18
|
+
or(condition) {
|
|
19
|
+
return new query_condition_chain_1.default(this, condition, 'or');
|
|
20
|
+
}
|
|
21
|
+
}
|
|
22
|
+
exports.default = QueryJoinCondition;
|
|
23
|
+
//# sourceMappingURL=query-join-condition.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-join-condition.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;AAEA,uDAA+C;AAC/C,mEAA0D;AAG1D,MAAqB,kBAAgG,SAAQ,yBAA+B;IAE9I,OAAO,CAAyB;IAChC,KAAK,CAAS;IACd,YAAY,CAAyB;IAE/C,YAAY,MAA8B,EAAE,IAAY,EAAE,WAAmC;QACzF,KAAK,EAAE,CAAC;QACR,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC;QAClB,IAAI,CAAC,YAAY,GAAG,WAAW,CAAC;IACpC,CAAC;IAED,GAAG,CAAsC,SAAiC;QACtE,OAAO,IAAI,+BAAmB,CAA2B,IAAI,EAAE,SAAS,EAAE,KAAK,CAAC,CAAC;IACrF,CAAC;IAED,EAAE,CAAsC,SAAiC;QACrE,OAAO,IAAI,+BAAmB,CAA2B,IAAI,EAAE,SAAS,EAAE,IAAI,CAAC,CAAC;IACpF,CAAC;CACJ;AApBD,qCAoBC"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
// TODO In TS generic parameters not used in the class are not enforced, so I have to add dummy fields that use them. Replace with nominal typing
|
|
4
|
+
class GenericsHelper {
|
|
5
|
+
}
|
|
6
|
+
exports.default = GenericsHelper;
|
|
7
|
+
//# sourceMappingURL=generics-helper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"generics-helper.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;AAAA,iJAAiJ;AACjJ,MAAqB,cAAc;CAAM;AAAzC,iCAAyC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type QueryAction = 'select' | 'insert' | 'update' | 'delete';
|
|
2
|
+
export type ColumnModifierType = 'as' | 'count' | 'min' | 'min' | 'max' | 'sum' | 'avg' | 'lower' | 'upper';
|
|
3
|
+
export interface ColumnModifier {
|
|
4
|
+
name: ColumnModifierType;
|
|
5
|
+
params?: any;
|
|
6
|
+
}
|
|
7
|
+
export type ColumnName = string | {
|
|
8
|
+
name: string;
|
|
9
|
+
alias: string;
|
|
10
|
+
};
|
|
11
|
+
export type ColumnType = 'boolean' | 'number' | 'string' | 'date';
|
|
12
|
+
export type ConditionChainType = 'or' | 'and';
|
|
13
|
+
export type ConditionType = 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'in' | 'not-in' | 'between' | 'not-between' | 'like' | 'not-like' | 'is-null' | 'is-not-null';
|
|
14
|
+
export type JoinType = 'inner' | 'left' | 'right' | 'full';
|
|
15
|
+
export type QueryProcessor = (query: any) => Promise<any>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"internal-types.js","sourceRoot":"","sources":[""],"names":[],"mappings":";AAAA,SAAS"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import QueryTable from "../query-table";
|
|
2
|
+
import QueryJoinCondition from "../condition/query-join-condition";
|
|
3
|
+
import JoinedTables from "./joined-tables";
|
|
4
|
+
import { JoinType } from "../helpers/internal-types";
|
|
5
|
+
export default class JoinedTablesChain<Tables extends QueryTable<any, any>> {
|
|
6
|
+
protected _table: QueryTable<any, any>;
|
|
7
|
+
protected _modifier: JoinType;
|
|
8
|
+
protected _parent: JoinedTables<Tables> | QueryTable<any, any>;
|
|
9
|
+
constructor(_table: QueryTable<any, any>, _modifier: JoinType, _parent: JoinedTables<Tables> | QueryTable<any, any>);
|
|
10
|
+
on(condition: QueryJoinCondition<Tables, Tables, any>): JoinedTables<Tables>;
|
|
11
|
+
}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const joined_tables_1 = require("./joined-tables");
|
|
4
|
+
class JoinedTablesChain {
|
|
5
|
+
_table;
|
|
6
|
+
_modifier;
|
|
7
|
+
_parent;
|
|
8
|
+
constructor(_table, _modifier, _parent) {
|
|
9
|
+
this._table = _table;
|
|
10
|
+
this._modifier = _modifier;
|
|
11
|
+
this._parent = _parent;
|
|
12
|
+
}
|
|
13
|
+
on(condition) {
|
|
14
|
+
return new joined_tables_1.default(condition, this);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
exports.default = JoinedTablesChain;
|
|
18
|
+
//# sourceMappingURL=joined-tables-chain.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"joined-tables-chain.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;AAEA,mDAA2C;AAG3C,MAAqB,iBAAiB;IAGpB;IACA;IACA;IAHd,YACc,MAA4B,EAC5B,SAAmB,EACnB,OAAoD;QAFpD,WAAM,GAAN,MAAM,CAAsB;QAC5B,cAAS,GAAT,SAAS,CAAU;QACnB,YAAO,GAAP,OAAO,CAA6C;IAC/D,CAAC;IAEJ,EAAE,CAAC,SAAkD;QACjD,OAAO,IAAI,uBAAY,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;IAC7C,CAAC;CACJ;AAXD,oCAWC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import QueryTable from "../query-table";
|
|
2
|
+
import JoinedTablesChain from "./joined-tables-chain";
|
|
3
|
+
import QueryJoinCondition from "../condition/query-join-condition";
|
|
4
|
+
export default class JoinedTables<Tables extends QueryTable<any, any>> {
|
|
5
|
+
protected _condition: QueryJoinCondition<Tables, Tables, any>;
|
|
6
|
+
protected _parent: JoinedTablesChain<Tables>;
|
|
7
|
+
constructor(_condition: QueryJoinCondition<Tables, Tables, any>, _parent: JoinedTablesChain<Tables>);
|
|
8
|
+
innerJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
|
|
9
|
+
leftJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
|
|
10
|
+
rightJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
|
|
11
|
+
fullJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable>;
|
|
12
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const joined_tables_chain_1 = require("./joined-tables-chain");
|
|
4
|
+
class JoinedTables {
|
|
5
|
+
_condition;
|
|
6
|
+
_parent;
|
|
7
|
+
constructor(_condition, _parent) {
|
|
8
|
+
this._condition = _condition;
|
|
9
|
+
this._parent = _parent;
|
|
10
|
+
}
|
|
11
|
+
innerJoin(table) {
|
|
12
|
+
return new joined_tables_chain_1.default(table, 'inner', this);
|
|
13
|
+
}
|
|
14
|
+
leftJoin(table) {
|
|
15
|
+
return new joined_tables_chain_1.default(table, 'left', this);
|
|
16
|
+
}
|
|
17
|
+
rightJoin(table) {
|
|
18
|
+
return new joined_tables_chain_1.default(table, 'right', this);
|
|
19
|
+
}
|
|
20
|
+
fullJoin(table) {
|
|
21
|
+
return new joined_tables_chain_1.default(table, 'full', this);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
exports.default = JoinedTables;
|
|
25
|
+
//# sourceMappingURL=joined-tables.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"joined-tables.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;AACA,+DAAsD;AAItD,MAAqB,YAAY;IAGf;IACA;IAFd,YACc,UAAmD,EACnD,OAAkC;QADlC,eAAU,GAAV,UAAU,CAAyC;QACnD,YAAO,GAAP,OAAO,CAA2B;IAC7C,CAAC;IAEJ,SAAS,CAAyC,KAAgB;QAC9D,OAAO,IAAI,6BAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAED,QAAQ,CAAyC,KAAgB;QAC7D,OAAO,IAAI,6BAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;IAED,SAAS,CAAyC,KAAgB;QAC9D,OAAO,IAAI,6BAAiB,CAAC,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACvD,CAAC;IAED,QAAQ,CAAyC,KAAgB;QAC7D,OAAO,IAAI,6BAAiB,CAAC,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACtD,CAAC;CACJ;AAtBD,+BAsBC"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import QueryColumn from "../column/query-column";
|
|
2
|
+
import QueryTable from "../query-table";
|
|
3
|
+
export default class QueryOrdering<Table extends QueryTable<any, any>> {
|
|
4
|
+
protected _column: QueryColumn<Table, any>;
|
|
5
|
+
protected _direction: 'ASC' | 'DESC';
|
|
6
|
+
protected _nullsPosition: 'FIRST' | 'LAST';
|
|
7
|
+
constructor(column: QueryColumn<Table, any>, direction: 'ASC' | 'DESC');
|
|
8
|
+
nullsFirst(): this;
|
|
9
|
+
nullsLast(): this;
|
|
10
|
+
}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class QueryOrdering {
|
|
4
|
+
_column;
|
|
5
|
+
_direction;
|
|
6
|
+
_nullsPosition;
|
|
7
|
+
constructor(column, direction) {
|
|
8
|
+
this._column = column;
|
|
9
|
+
this._direction = direction;
|
|
10
|
+
}
|
|
11
|
+
nullsFirst() {
|
|
12
|
+
this._nullsPosition = 'FIRST';
|
|
13
|
+
return this;
|
|
14
|
+
}
|
|
15
|
+
nullsLast() {
|
|
16
|
+
this._nullsPosition = 'LAST';
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
exports.default = QueryOrdering;
|
|
21
|
+
//# sourceMappingURL=query-ordering.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-ordering.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;AAIA,MAAqB,aAAa;IAEpB,OAAO,CAA0B;IACjC,UAAU,CAAiB;IAC3B,cAAc,CAAmB;IAE3C,YAAY,MAA+B,EAAE,SAAyB;QAClE,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;IAChC,CAAC;IAED,UAAU;QACN,IAAI,CAAC,cAAc,GAAG,OAAO,CAAC;QAC9B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,SAAS;QACL,IAAI,CAAC,cAAc,GAAG,MAAM,CAAC;QAC7B,OAAO,IAAI,CAAC;IAChB,CAAC;CAEJ;AArBD,gCAqBC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import QueryCondition from "../condition/query-condition";
|
|
2
|
+
import QueryOrdering from "../other/query-ordering";
|
|
3
|
+
import QueryTable from "../query-table";
|
|
4
|
+
import QueryColumn from "../column/query-column";
|
|
5
|
+
import { QueryProcessor, QueryAction } from "../helpers/internal-types";
|
|
6
|
+
export default class SelectQuery<Entity, Table extends QueryTable<Entity, any>> {
|
|
7
|
+
protected _queryProcessor: QueryProcessor;
|
|
8
|
+
protected _tables: Table[];
|
|
9
|
+
constructor(_queryProcessor: QueryProcessor, _tables: Table[]);
|
|
10
|
+
protected _distinct: boolean;
|
|
11
|
+
protected _offset: number;
|
|
12
|
+
protected _limit: number;
|
|
13
|
+
protected _conditions: QueryCondition<Table>[];
|
|
14
|
+
protected _groupBy: QueryColumn<Table, any>[];
|
|
15
|
+
protected _having: QueryCondition<Table>[];
|
|
16
|
+
protected _orderings: (QueryColumn<Table, any> | QueryOrdering<Table>)[];
|
|
17
|
+
protected _columns: QueryColumn<Table, any>[];
|
|
18
|
+
protected _action: QueryAction;
|
|
19
|
+
offset(offset: number): this;
|
|
20
|
+
limit(limit: number): this;
|
|
21
|
+
distinct(): this;
|
|
22
|
+
where(...conditions: QueryCondition<Table>[]): this;
|
|
23
|
+
groupBy(...columns: QueryColumn<Table, any>[]): this;
|
|
24
|
+
having(...conditions: QueryCondition<Table>[]): this;
|
|
25
|
+
orderBy(...orderings: (QueryColumn<Table, any> | QueryOrdering<Table>)[]): this;
|
|
26
|
+
select(): Promise<Entity[]>;
|
|
27
|
+
select<T>(column: QueryColumn<Table, T>): Promise<T[]>;
|
|
28
|
+
select(...columns: QueryColumn<Table, any>[]): Promise<any[]>;
|
|
29
|
+
}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class SelectQuery {
|
|
4
|
+
_queryProcessor;
|
|
5
|
+
_tables;
|
|
6
|
+
constructor(_queryProcessor, _tables) {
|
|
7
|
+
this._queryProcessor = _queryProcessor;
|
|
8
|
+
this._tables = _tables;
|
|
9
|
+
}
|
|
10
|
+
_distinct = false;
|
|
11
|
+
_offset;
|
|
12
|
+
_limit;
|
|
13
|
+
_conditions = [];
|
|
14
|
+
_groupBy = [];
|
|
15
|
+
_having = [];
|
|
16
|
+
_orderings = [];
|
|
17
|
+
_columns = [];
|
|
18
|
+
_action;
|
|
19
|
+
offset(offset) {
|
|
20
|
+
this._offset = offset;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
limit(limit) {
|
|
24
|
+
this._limit = limit;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
distinct() {
|
|
28
|
+
this._distinct = true;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
where(...conditions) {
|
|
32
|
+
this._conditions = conditions;
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
groupBy(...columns) {
|
|
36
|
+
this._groupBy = columns;
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
having(...conditions) {
|
|
40
|
+
this._having = conditions;
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
orderBy(...orderings) {
|
|
44
|
+
this._orderings = orderings;
|
|
45
|
+
return this;
|
|
46
|
+
}
|
|
47
|
+
select(...columns) {
|
|
48
|
+
this._columns = columns;
|
|
49
|
+
this._action = 'select';
|
|
50
|
+
return this._queryProcessor(this);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
exports.default = SelectQuery;
|
|
54
|
+
//# sourceMappingURL=select-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"select-query.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;AAOA,MAAqB,WAAW;IAGd;IACA;IAFd,YACc,eAA+B,EAC/B,OAAgB;QADhB,oBAAe,GAAf,eAAe,CAAgB;QAC/B,YAAO,GAAP,OAAO,CAAS;IAC3B,CAAC;IAEM,SAAS,GAAG,KAAK,CAAC;IAClB,OAAO,CAAS;IAChB,MAAM,CAAS;IACf,WAAW,GAA4B,EAAE,CAAC;IAC1C,QAAQ,GAA8B,EAAE,CAAC;IACzC,OAAO,GAA4B,EAAE,CAAC;IACtC,UAAU,GAAuD,EAAE,CAAC;IACpE,QAAQ,GAA8B,EAAE,CAAC;IACzC,OAAO,CAAc;IAE/B,MAAM,CAAC,MAAc;QACjB,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,KAAa;QACf,IAAI,CAAC,MAAM,GAAG,KAAK,CAAC;QACpB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,QAAQ;QACJ,IAAI,CAAC,SAAS,GAAG,IAAI,CAAC;QACtB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,KAAK,CAAC,GAAG,UAAmC;QACxC,IAAI,CAAC,WAAW,GAAG,UAAU,CAAC;QAC9B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,GAAG,OAAkC;QACzC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,MAAM,CAAC,GAAG,UAAmC;QACzC,IAAI,CAAC,OAAO,GAAG,UAAU,CAAC;QAC1B,OAAO,IAAI,CAAC;IAChB,CAAC;IAED,OAAO,CAAC,GAAG,SAA6D;QACpE,IAAI,CAAC,UAAU,GAAG,SAAS,CAAC;QAC5B,OAAO,IAAI,CAAC;IAChB,CAAC;IAKD,MAAM,CAAC,GAAG,OAAkC;QACxC,IAAI,CAAC,QAAQ,GAAG,OAAO,CAAC;QACxB,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;CACJ;AA5DD,8BA4DC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import QueryTable from "../query-table";
|
|
2
|
+
import QueryCondition from "../condition/query-condition";
|
|
3
|
+
import QueryColumn from "../column/query-column";
|
|
4
|
+
import { QueryProcessor, QueryAction } from "../helpers/internal-types";
|
|
5
|
+
export default class TableConditionQuery<Entity, Table extends QueryTable<Entity, any>> {
|
|
6
|
+
protected _queryProcessor: QueryProcessor;
|
|
7
|
+
protected _table: Table;
|
|
8
|
+
protected _conditions: QueryCondition<Table>[];
|
|
9
|
+
constructor(_queryProcessor: QueryProcessor, _table: Table, _conditions: QueryCondition<Table>[]);
|
|
10
|
+
protected _columns: QueryColumn<Table, any>[];
|
|
11
|
+
protected _action: QueryAction;
|
|
12
|
+
protected _entity: Entity | Partial<Entity>;
|
|
13
|
+
update(entity: Partial<Entity>): Promise<number>;
|
|
14
|
+
delete(): Promise<number>;
|
|
15
|
+
count(): Promise<number>;
|
|
16
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
class TableConditionQuery {
|
|
4
|
+
_queryProcessor;
|
|
5
|
+
_table;
|
|
6
|
+
_conditions;
|
|
7
|
+
constructor(_queryProcessor, _table, _conditions) {
|
|
8
|
+
this._queryProcessor = _queryProcessor;
|
|
9
|
+
this._table = _table;
|
|
10
|
+
this._conditions = _conditions;
|
|
11
|
+
}
|
|
12
|
+
_columns = [];
|
|
13
|
+
_action;
|
|
14
|
+
_entity;
|
|
15
|
+
update(entity) {
|
|
16
|
+
this._entity = entity;
|
|
17
|
+
this._action = 'update';
|
|
18
|
+
return this._queryProcessor(this);
|
|
19
|
+
}
|
|
20
|
+
delete() {
|
|
21
|
+
this._action = 'delete';
|
|
22
|
+
return this._queryProcessor(this);
|
|
23
|
+
}
|
|
24
|
+
count() {
|
|
25
|
+
this._columns = [this._table.$all.count()];
|
|
26
|
+
this._action = 'select';
|
|
27
|
+
return this._queryProcessor(this).then((rows) => rows[0]);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
exports.default = TableConditionQuery;
|
|
31
|
+
//# sourceMappingURL=table-condition-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-condition-query.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;AAMA,MAAqB,mBAAmB;IAGtB;IACA;IACA;IAHd,YACc,eAA+B,EAC/B,MAAa,EACb,WAAoC;QAFpC,oBAAe,GAAf,eAAe,CAAgB;QAC/B,WAAM,GAAN,MAAM,CAAO;QACb,gBAAW,GAAX,WAAW,CAAyB;IAC/C,CAAC;IAEM,QAAQ,GAA8B,EAAE,CAAC;IACzC,OAAO,CAAc;IACrB,OAAO,CAA2B;IAE5C,MAAM,CAAC,MAAuB;QAC1B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,MAAM;QACF,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,KAAK;QACD,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAc,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACxE,CAAC;CACJ;AA5BD,sCA4BC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import QueryTable from "../query-table";
|
|
2
|
+
import TableConditionQuery from "./table-condition-query";
|
|
3
|
+
import QueryCondition from "../condition/query-condition";
|
|
4
|
+
import QueryColumn from "../column/query-column";
|
|
5
|
+
import { QueryProcessor, QueryAction } from "../helpers/internal-types";
|
|
6
|
+
export default class TableQuery<Entity, Id, Table extends QueryTable<Entity, Id>> {
|
|
7
|
+
protected _queryProcessor: QueryProcessor;
|
|
8
|
+
protected _table: Table;
|
|
9
|
+
constructor(_queryProcessor: QueryProcessor, _table: Table);
|
|
10
|
+
protected _entity: Entity | Entity[] | Partial<Entity>;
|
|
11
|
+
protected _action: QueryAction;
|
|
12
|
+
protected _columns: QueryColumn<Table, any>[];
|
|
13
|
+
where(...conditions: QueryCondition<Table>[]): TableConditionQuery<Entity, Table>;
|
|
14
|
+
insert(entity: Entity): Promise<any>;
|
|
15
|
+
insert(entities: Entity[]): Promise<void>;
|
|
16
|
+
deleteAll(): Promise<number>;
|
|
17
|
+
updateAll(entity: Partial<Entity>): Promise<number>;
|
|
18
|
+
countAll(): Promise<number>;
|
|
19
|
+
delete(id: Id): Promise<boolean>;
|
|
20
|
+
update(id: Id, entity: Partial<Entity>): Promise<boolean>;
|
|
21
|
+
get(id: Id): Promise<Entity | undefined>;
|
|
22
|
+
_whereId(id: Id): TableConditionQuery<Entity, Table>;
|
|
23
|
+
}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const table_condition_query_1 = require("./table-condition-query");
|
|
4
|
+
const value_column_1 = require("../column/value-column");
|
|
5
|
+
class TableQuery {
|
|
6
|
+
_queryProcessor;
|
|
7
|
+
_table;
|
|
8
|
+
constructor(_queryProcessor, _table) {
|
|
9
|
+
this._queryProcessor = _queryProcessor;
|
|
10
|
+
this._table = _table;
|
|
11
|
+
}
|
|
12
|
+
_entity;
|
|
13
|
+
_action;
|
|
14
|
+
_columns = [];
|
|
15
|
+
where(...conditions) {
|
|
16
|
+
return new table_condition_query_1.default(this._queryProcessor, this._table, conditions);
|
|
17
|
+
}
|
|
18
|
+
insert(param) {
|
|
19
|
+
this._entity = param;
|
|
20
|
+
this._action = 'insert';
|
|
21
|
+
return this._queryProcessor(this);
|
|
22
|
+
}
|
|
23
|
+
deleteAll() {
|
|
24
|
+
this._action = 'delete';
|
|
25
|
+
return this._queryProcessor(this);
|
|
26
|
+
}
|
|
27
|
+
updateAll(entity) {
|
|
28
|
+
this._entity = entity;
|
|
29
|
+
this._action = 'update';
|
|
30
|
+
return this._queryProcessor(this);
|
|
31
|
+
}
|
|
32
|
+
countAll() {
|
|
33
|
+
this._columns = [this._table.$all.count()];
|
|
34
|
+
this._action = 'select';
|
|
35
|
+
return this._queryProcessor(this).then((rows) => rows[0]);
|
|
36
|
+
}
|
|
37
|
+
delete(id) {
|
|
38
|
+
return this._whereId(id).delete().then(count => count > 0);
|
|
39
|
+
}
|
|
40
|
+
update(id, entity) {
|
|
41
|
+
return this._whereId(id).update(entity).then(count => count > 0);
|
|
42
|
+
}
|
|
43
|
+
get(id) {
|
|
44
|
+
let query = this._whereId(id);
|
|
45
|
+
return this._queryProcessor({ _action: 'select', ...query })
|
|
46
|
+
.then((rows) => rows[0]);
|
|
47
|
+
}
|
|
48
|
+
_whereId(id) {
|
|
49
|
+
// TODO remove assertions if $id typing is fixed
|
|
50
|
+
let $id = this._table.$id;
|
|
51
|
+
if ($id instanceof value_column_1.default) {
|
|
52
|
+
return this.where($id.eq(id));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return this.where(...Object.keys($id).map(key => this._table[key].eq(id[key])));
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
exports.default = TableQuery;
|
|
60
|
+
//# sourceMappingURL=table-query.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"table-query.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;AACA,mEAA0D;AAE1D,yDAAiD;AAKjD,MAAqB,UAAU;IAGb;IACA;IAFd,YACc,eAA+B,EAC/B,MAAa;QADb,oBAAe,GAAf,eAAe,CAAgB;QAC/B,WAAM,GAAN,MAAM,CAAO;IACxB,CAAC;IAEM,OAAO,CAAsC;IAC7C,OAAO,CAAc;IACrB,QAAQ,GAA8B,EAAE,CAAC;IAEnD,KAAK,CAAC,GAAG,UAAmC;QACxC,OAAO,IAAI,+BAAmB,CAAgB,IAAI,CAAC,eAAe,EAAE,IAAI,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC;IACjG,CAAC;IAID,MAAM,CAAC,KAAU;QACb,IAAI,CAAC,OAAO,GAAG,KAAK,CAAC;QACrB,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,SAAS;QACL,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,SAAS,CAAC,MAAuB;QAC7B,IAAI,CAAC,OAAO,GAAG,MAAM,CAAC;QACtB,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC;IACtC,CAAC;IAED,QAAQ;QACJ,IAAI,CAAC,QAAQ,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,KAAK,EAAE,CAAC,CAAC;QAC3C,IAAI,CAAC,OAAO,GAAG,QAAQ,CAAC;QACxB,OAAO,IAAI,CAAC,eAAe,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,CAAC,IAAW,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,MAAM,CAAC,EAAM;QACT,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IAC/D,CAAC;IAED,MAAM,CAAC,EAAM,EAAE,MAAuB;QAClC,OAAO,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC,KAAK,GAAG,CAAC,CAAC,CAAC;IACrE,CAAC;IAED,GAAG,CAAC,EAAM;QACN,IAAI,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;QAC9B,OAAO,IAAI,CAAC,eAAe,CAAC,EAAE,OAAO,EAAE,QAAQ,EAAE,GAAG,KAAK,EAAE,CAAC;aACvD,IAAI,CAAC,CAAC,IAAc,EAAE,EAAE,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC,CAAC;IAC3C,CAAC;IAED,QAAQ,CAAC,EAAM;QACX,gDAAgD;QAChD,IAAI,GAAG,GAAI,IAAI,CAAC,MAAc,CAAC,GAAG,CAAC;QACnC,IAAI,GAAG,YAAY,sBAAW,EAAE,CAAC;YAC7B,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;QAClC,CAAC;aAAM,CAAC;YACJ,OAAO,IAAI,CAAC,KAAK,CAAC,GAAG,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,CAAG,IAAI,CAAC,MAAc,CAAC,GAAG,CAA6B,CAAC,EAAE,CAAE,EAAU,CAAC,GAAG,CAAQ,CAAC,CAAC,CAAC,CAAC;QAC1I,CAAC;IACL,CAAC;CACJ;AA/DD,6BA+DC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import QueryTable from './query-table';
|
|
2
|
+
import SelectQuery from './query/select-query';
|
|
3
|
+
import { QueryProcessor } from "./helpers/internal-types";
|
|
4
|
+
import JoinedTables from "./join/joined-tables";
|
|
5
|
+
import TableQuery from "./query/table-query";
|
|
6
|
+
export default class QuerySource {
|
|
7
|
+
protected _queryProcessor: QueryProcessor;
|
|
8
|
+
constructor(_queryProcessor: QueryProcessor);
|
|
9
|
+
from<Entity, Table1 extends QueryTable<Entity, any>>(table1: Table1 & QueryTable<Entity, any>): SelectQuery<Entity, Table1>;
|
|
10
|
+
from<Tables extends QueryTable<any, any>>(tables: JoinedTables<Tables>): SelectQuery<any, Tables>;
|
|
11
|
+
from<Table1 extends QueryTable<any, any>, Table2 extends QueryTable<any, any>>(table1: Table1, table2: Table2): SelectQuery<any, Table1 | Table2>;
|
|
12
|
+
from<Table1 extends QueryTable<any, any>, Table2 extends QueryTable<any, any>, Table3 extends QueryTable<any, any>>(table1: Table1, table2: Table2, table3: Table3): SelectQuery<any, Table1 | Table2 | Table3>;
|
|
13
|
+
table<Entity, Id, Table extends QueryTable<Entity, Id>>(table: Table & QueryTable<Entity, Id>): TableQuery<Entity, Id, Table>;
|
|
14
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const select_query_1 = require("./query/select-query");
|
|
4
|
+
const table_query_1 = require("./query/table-query");
|
|
5
|
+
class QuerySource {
|
|
6
|
+
_queryProcessor;
|
|
7
|
+
constructor(_queryProcessor) {
|
|
8
|
+
this._queryProcessor = _queryProcessor;
|
|
9
|
+
}
|
|
10
|
+
from(table1, table2, table3) {
|
|
11
|
+
if (table3 != null)
|
|
12
|
+
return new select_query_1.default(this._queryProcessor, [table1, table2, table3]);
|
|
13
|
+
else if (table2 != null)
|
|
14
|
+
return new select_query_1.default(this._queryProcessor, [table1, table2]);
|
|
15
|
+
return new select_query_1.default(this._queryProcessor, [table1]);
|
|
16
|
+
}
|
|
17
|
+
table(table) {
|
|
18
|
+
return new table_query_1.default(this._queryProcessor, table);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
21
|
+
exports.default = QuerySource;
|
|
22
|
+
//# sourceMappingURL=query-source.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-source.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;AACA,uDAA+C;AAG/C,qDAA6C;AAG7C,MAAqB,WAAW;IAEN;IAAtB,YAAsB,eAA+B;QAA/B,oBAAe,GAAf,eAAe,CAAgB;IAAG,CAAC;IAMzD,IAAI,CAAwH,MAAW,EAAE,MAAY,EAAE,MAAY;QAC/J,IAAI,MAAM,IAAI,IAAI;YAAE,OAAO,IAAI,sBAAW,CAAgC,IAAI,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;aACrH,IAAI,MAAM,IAAI,IAAI;YAAE,OAAO,IAAI,sBAAW,CAAuB,IAAI,CAAC,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;QAC9G,OAAO,IAAI,sBAAW,CAAiB,IAAI,CAAC,eAAe,EAAE,CAAC,MAAM,CAAC,CAAC,CAAC;IAC3E,CAAC;IAED,KAAK,CAAmD,KAAqC;QACzF,OAAO,IAAI,qBAAU,CAAoB,IAAI,CAAC,eAAe,EAAE,KAAK,CAAC,CAAC;IAC1E,CAAC;CACJ;AAjBD,8BAiBC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import BasicColumn from "./column/basic-column";
|
|
2
|
+
import GenericsHelper from "./helpers/generics-helper";
|
|
3
|
+
import JoinedTablesChain from "./join/joined-tables-chain";
|
|
4
|
+
declare abstract class QueryTable<Entity, Id> {
|
|
5
|
+
protected _$name: string;
|
|
6
|
+
constructor(_$name: string);
|
|
7
|
+
protected _$type: GenericsHelper<Entity>;
|
|
8
|
+
protected _$idType: GenericsHelper<Id>;
|
|
9
|
+
$all: BasicColumn<this, Entity>;
|
|
10
|
+
innerJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<this | JoinTable>;
|
|
11
|
+
leftJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<this | JoinTable>;
|
|
12
|
+
rightJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<this | JoinTable>;
|
|
13
|
+
fullJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<this | JoinTable>;
|
|
14
|
+
}
|
|
15
|
+
export default QueryTable;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const basic_column_1 = require("./column/basic-column");
|
|
4
|
+
const joined_tables_chain_1 = require("./join/joined-tables-chain");
|
|
5
|
+
class QueryTable {
|
|
6
|
+
_$name;
|
|
7
|
+
constructor(_$name) {
|
|
8
|
+
this._$name = _$name;
|
|
9
|
+
}
|
|
10
|
+
_$type;
|
|
11
|
+
_$idType;
|
|
12
|
+
// abstract readonly $id; // FIXME I got a dozen incomprehensible type errors
|
|
13
|
+
$all = new basic_column_1.default(this, '*');
|
|
14
|
+
innerJoin(table) {
|
|
15
|
+
return new joined_tables_chain_1.default(table, 'inner', this);
|
|
16
|
+
}
|
|
17
|
+
leftJoin(table) {
|
|
18
|
+
return new joined_tables_chain_1.default(table, 'left', this);
|
|
19
|
+
}
|
|
20
|
+
rightJoin(table) {
|
|
21
|
+
return new joined_tables_chain_1.default(table, 'right', this);
|
|
22
|
+
}
|
|
23
|
+
fullJoin(table) {
|
|
24
|
+
return new joined_tables_chain_1.default(table, 'full', this);
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
exports.default = QueryTable;
|
|
28
|
+
//# sourceMappingURL=query-table.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"query-table.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;AAAA,wDAAgD;AAEhD,oEAA2D;AAG3D,MAAe,UAAU;IAEC;IAAtB,YAAsB,MAAc;QAAd,WAAM,GAAN,MAAM,CAAQ;IAAG,CAAC;IAE9B,MAAM,CAAyB;IAC/B,QAAQ,CAAqB;IAEvC,6EAA6E;IAE7E,IAAI,GAAG,IAAI,sBAAW,CAAe,IAAI,EAAE,GAAG,CAAC,CAAC;IAEhD,SAAS,CAAyC,KAAgB;QAC9D,OAAO,IAAI,6BAAiB,CAAmB,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;IAED,QAAQ,CAAyC,KAAgB;QAC7D,OAAO,IAAI,6BAAiB,CAAmB,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACxE,CAAC;IAED,SAAS,CAAyC,KAAgB;QAC9D,OAAO,IAAI,6BAAiB,CAAmB,KAAK,EAAE,OAAO,EAAE,IAAI,CAAC,CAAC;IACzE,CAAC;IAED,QAAQ,CAAyC,KAAgB;QAC7D,OAAO,IAAI,6BAAiB,CAAmB,KAAK,EAAE,MAAM,EAAE,IAAI,CAAC,CAAC;IACxE,CAAC;CACJ;AAED,kBAAe,UAAU,CAAC"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
const query_source_1 = require("../builder/query-source");
|
|
4
|
+
const query_processor_1 = require("./query-processor");
|
|
5
|
+
class MySqlQuerySource extends query_source_1.default {
|
|
6
|
+
constructor(client, options = {}) {
|
|
7
|
+
super((0, query_processor_1.createQueryProcessor)(client, options, 'mysql'));
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
exports.default = MySqlQuerySource;
|
|
11
|
+
//# sourceMappingURL=mysql.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mysql.js","sourceRoot":"","sources":[""],"names":[],"mappings":";;AAAA,0DAAkD;AAClD,uDAA8E;AAE9E,MAAqB,gBAAiB,SAAQ,sBAAW;IAErD,YAAY,MAAW,EAAE,UAAiC,EAAE;QACxD,KAAK,CAAC,IAAA,sCAAoB,EAAC,MAAM,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;IAC1D,CAAC;CACJ;AALD,mCAKC"}
|