taon-type-sql 21.0.21 → 21.0.23
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/package.json +1 -1
- package/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib/build-info._auto-generated_.js +1 -1
- package/lib/package.json +1 -1
- package/lib-prod/build-info._auto-generated_.js +14 -30
- package/lib-prod/builder/column/basic-column.js +12 -14
- package/lib-prod/builder/column/boolean-column.js +13 -14
- package/lib-prod/builder/column/comparable-column.js +41 -41
- package/lib-prod/builder/column/date-column.js +13 -14
- package/lib-prod/builder/column/number-column.js +18 -19
- package/lib-prod/builder/column/query-column.js +22 -24
- package/lib-prod/builder/column/string-column.js +35 -36
- package/lib-prod/builder/column/value-column.js +27 -28
- package/lib-prod/builder/condition/query-column-condition.js +21 -22
- package/lib-prod/builder/condition/query-condition-chain.js +32 -33
- package/lib-prod/builder/condition/query-condition.js +4 -5
- package/lib-prod/builder/condition/query-join-condition.js +21 -22
- package/lib-prod/builder/helpers/generics-helper.js +3 -5
- package/lib-prod/builder/helpers/internal-types.js +0 -4
- package/lib-prod/builder/join/joined-tables-chain.js +12 -16
- package/lib-prod/builder/join/joined-tables.js +20 -23
- package/lib-prod/builder/other/query-ordering.js +18 -19
- package/lib-prod/builder/query/select-query.js +49 -52
- package/lib-prod/builder/query/table-condition-query.js +25 -29
- package/lib-prod/builder/query/table-query.js +52 -58
- package/lib-prod/builder/query-source.js +16 -20
- package/lib-prod/builder/query-table.js +25 -26
- package/lib-prod/client/mysql.js +9 -10
- package/lib-prod/client/pg.js +9 -10
- package/lib-prod/client/query-processor.js +39 -68
- package/lib-prod/converter/param-converter.js +19 -27
- package/lib-prod/converter/parameterized-converter.js +13 -14
- package/lib-prod/converter/query-converter.js +243 -259
- package/lib-prod/converter/result-converter.js +61 -73
- package/lib-prod/converter/sql-converter.js +6 -7
- package/lib-prod/converter/type-converter.js +24 -35
- package/lib-prod/converter/types.js +0 -3
- package/lib-prod/env/env.angular-node-app.js +130 -71
- package/lib-prod/env/env.docs-webapp.js +130 -71
- package/lib-prod/env/env.electron-app.js +130 -71
- package/lib-prod/env/env.mobile-app.js +130 -71
- package/lib-prod/env/env.npm-lib-and-cli-tool.js +130 -71
- package/lib-prod/env/env.vscode-plugin.js +130 -71
- package/lib-prod/env/index.js +6 -23
- package/lib-prod/index._auto-generated_.js +0 -6
- package/lib-prod/index.js +46 -48
- package/lib-prod/migrations/index.js +1 -19
- package/lib-prod/migrations/migrations_index._auto-generated_.js +0 -4
- package/lib-prod/package.json +1 -1
- package/package.json +1 -1
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
- package/lib-prod/build-info._auto-generated_.d.ts +0 -24
- package/lib-prod/build-info._auto-generated_.js.map +0 -1
- package/lib-prod/builder/column/basic-column.d.ts +0 -8
- package/lib-prod/builder/column/basic-column.js.map +0 -1
- package/lib-prod/builder/column/boolean-column.d.ts +0 -9
- package/lib-prod/builder/column/boolean-column.js.map +0 -1
- package/lib-prod/builder/column/comparable-column.d.ts +0 -18
- package/lib-prod/builder/column/comparable-column.js.map +0 -1
- package/lib-prod/builder/column/date-column.d.ts +0 -9
- package/lib-prod/builder/column/date-column.js.map +0 -1
- package/lib-prod/builder/column/number-column.d.ts +0 -10
- package/lib-prod/builder/column/number-column.js.map +0 -1
- package/lib-prod/builder/column/query-column.d.ts +0 -18
- package/lib-prod/builder/column/query-column.js.map +0 -1
- package/lib-prod/builder/column/string-column.d.ts +0 -17
- package/lib-prod/builder/column/string-column.js.map +0 -1
- package/lib-prod/builder/column/value-column.d.ts +0 -15
- package/lib-prod/builder/column/value-column.js.map +0 -1
- package/lib-prod/builder/condition/query-column-condition.d.ts +0 -13
- package/lib-prod/builder/condition/query-column-condition.js.map +0 -1
- package/lib-prod/builder/condition/query-condition-chain.d.ts +0 -17
- package/lib-prod/builder/condition/query-condition-chain.js.map +0 -1
- package/lib-prod/builder/condition/query-condition.d.ts +0 -7
- package/lib-prod/builder/condition/query-condition.js.map +0 -1
- package/lib-prod/builder/condition/query-join-condition.d.ts +0 -12
- package/lib-prod/builder/condition/query-join-condition.js.map +0 -1
- package/lib-prod/builder/helpers/generics-helper.d.ts +0 -2
- package/lib-prod/builder/helpers/generics-helper.js.map +0 -1
- package/lib-prod/builder/helpers/internal-types.d.ts +0 -15
- package/lib-prod/builder/helpers/internal-types.js.map +0 -1
- package/lib-prod/builder/join/joined-tables-chain.d.ts +0 -11
- package/lib-prod/builder/join/joined-tables-chain.js.map +0 -1
- package/lib-prod/builder/join/joined-tables.d.ts +0 -12
- package/lib-prod/builder/join/joined-tables.js.map +0 -1
- package/lib-prod/builder/other/query-ordering.d.ts +0 -10
- package/lib-prod/builder/other/query-ordering.js.map +0 -1
- package/lib-prod/builder/query/select-query.d.ts +0 -29
- package/lib-prod/builder/query/select-query.js.map +0 -1
- package/lib-prod/builder/query/table-condition-query.d.ts +0 -16
- package/lib-prod/builder/query/table-condition-query.js.map +0 -1
- package/lib-prod/builder/query/table-query.d.ts +0 -23
- package/lib-prod/builder/query/table-query.js.map +0 -1
- package/lib-prod/builder/query-source.d.ts +0 -14
- package/lib-prod/builder/query-source.js.map +0 -1
- package/lib-prod/builder/query-table.d.ts +0 -15
- package/lib-prod/builder/query-table.js.map +0 -1
- package/lib-prod/client/mysql.d.ts +0 -5
- package/lib-prod/client/mysql.js.map +0 -1
- package/lib-prod/client/pg.d.ts +0 -5
- package/lib-prod/client/pg.js.map +0 -1
- package/lib-prod/client/query-processor.d.ts +0 -10
- package/lib-prod/client/query-processor.js.map +0 -1
- package/lib-prod/converter/param-converter.d.ts +0 -2
- package/lib-prod/converter/param-converter.js.map +0 -1
- package/lib-prod/converter/parameterized-converter.d.ts +0 -5
- package/lib-prod/converter/parameterized-converter.js.map +0 -1
- package/lib-prod/converter/query-converter.d.ts +0 -2
- package/lib-prod/converter/query-converter.js.map +0 -1
- package/lib-prod/converter/result-converter.d.ts +0 -2
- package/lib-prod/converter/result-converter.js.map +0 -1
- package/lib-prod/converter/sql-converter.d.ts +0 -2
- package/lib-prod/converter/sql-converter.js.map +0 -1
- package/lib-prod/converter/type-converter.d.ts +0 -4
- package/lib-prod/converter/type-converter.js.map +0 -1
- package/lib-prod/converter/types.d.ts +0 -5
- package/lib-prod/converter/types.js.map +0 -1
- package/lib-prod/env/env.angular-node-app.d.ts +0 -64
- package/lib-prod/env/env.angular-node-app.js.map +0 -1
- package/lib-prod/env/env.docs-webapp.d.ts +0 -64
- package/lib-prod/env/env.docs-webapp.js.map +0 -1
- package/lib-prod/env/env.electron-app.d.ts +0 -64
- package/lib-prod/env/env.electron-app.js.map +0 -1
- package/lib-prod/env/env.mobile-app.d.ts +0 -64
- package/lib-prod/env/env.mobile-app.js.map +0 -1
- package/lib-prod/env/env.npm-lib-and-cli-tool.d.ts +0 -64
- package/lib-prod/env/env.npm-lib-and-cli-tool.js.map +0 -1
- package/lib-prod/env/env.vscode-plugin.d.ts +0 -64
- package/lib-prod/env/env.vscode-plugin.js.map +0 -1
- package/lib-prod/env/index.d.ts +0 -6
- package/lib-prod/env/index.js.map +0 -1
- package/lib-prod/index._auto-generated_.d.ts +0 -0
- package/lib-prod/index._auto-generated_.js.map +0 -1
- package/lib-prod/index.d.ts +0 -25
- package/lib-prod/index.js.map +0 -1
- package/lib-prod/migrations/index.d.ts +0 -1
- package/lib-prod/migrations/index.js.map +0 -1
- package/lib-prod/migrations/migrations_index._auto-generated_.d.ts +0 -0
- package/lib-prod/migrations/migrations_index._auto-generated_.js.map +0 -1
|
@@ -1,23 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
return new query_condition_chain_1.default(this, condition, 'or');
|
|
20
|
-
}
|
|
1
|
+
import QueryCondition from "./query-condition";
|
|
2
|
+
import QueryConditionChain from "./query-condition-chain";
|
|
3
|
+
class QueryJoinCondition extends QueryCondition {
|
|
4
|
+
_column;
|
|
5
|
+
_type;
|
|
6
|
+
_otherColumn;
|
|
7
|
+
constructor(column, type, otherColumn) {
|
|
8
|
+
super();
|
|
9
|
+
this._column = column;
|
|
10
|
+
this._type = type;
|
|
11
|
+
this._otherColumn = otherColumn;
|
|
12
|
+
}
|
|
13
|
+
and(condition) {
|
|
14
|
+
return new QueryConditionChain(this, condition, "and");
|
|
15
|
+
}
|
|
16
|
+
or(condition) {
|
|
17
|
+
return new QueryConditionChain(this, condition, "or");
|
|
18
|
+
}
|
|
21
19
|
}
|
|
22
|
-
|
|
23
|
-
|
|
20
|
+
export {
|
|
21
|
+
QueryJoinCondition as default
|
|
22
|
+
};
|
|
@@ -1,7 +1,5 @@
|
|
|
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
1
|
class GenericsHelper {
|
|
5
2
|
}
|
|
6
|
-
|
|
7
|
-
|
|
3
|
+
export {
|
|
4
|
+
GenericsHelper as default
|
|
5
|
+
};
|
|
@@ -1,18 +1,14 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const joined_tables_1 = require("./joined-tables");
|
|
1
|
+
import JoinedTables from "./joined-tables";
|
|
4
2
|
class JoinedTablesChain {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
on(condition) {
|
|
14
|
-
return new joined_tables_1.default(condition, this);
|
|
15
|
-
}
|
|
3
|
+
constructor(_table, _modifier, _parent) {
|
|
4
|
+
this._table = _table;
|
|
5
|
+
this._modifier = _modifier;
|
|
6
|
+
this._parent = _parent;
|
|
7
|
+
}
|
|
8
|
+
on(condition) {
|
|
9
|
+
return new JoinedTables(condition, this);
|
|
10
|
+
}
|
|
16
11
|
}
|
|
17
|
-
|
|
18
|
-
|
|
12
|
+
export {
|
|
13
|
+
JoinedTablesChain as default
|
|
14
|
+
};
|
|
@@ -1,25 +1,22 @@
|
|
|
1
|
-
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const joined_tables_chain_1 = require("./joined-tables-chain");
|
|
1
|
+
import JoinedTablesChain from "./joined-tables-chain";
|
|
4
2
|
class JoinedTables {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
return new joined_tables_chain_1.default(table, 'full', this);
|
|
22
|
-
}
|
|
3
|
+
constructor(_condition, _parent) {
|
|
4
|
+
this._condition = _condition;
|
|
5
|
+
this._parent = _parent;
|
|
6
|
+
}
|
|
7
|
+
innerJoin(table) {
|
|
8
|
+
return new JoinedTablesChain(table, "inner", this);
|
|
9
|
+
}
|
|
10
|
+
leftJoin(table) {
|
|
11
|
+
return new JoinedTablesChain(table, "left", this);
|
|
12
|
+
}
|
|
13
|
+
rightJoin(table) {
|
|
14
|
+
return new JoinedTablesChain(table, "right", this);
|
|
15
|
+
}
|
|
16
|
+
fullJoin(table) {
|
|
17
|
+
return new JoinedTablesChain(table, "full", this);
|
|
18
|
+
}
|
|
23
19
|
}
|
|
24
|
-
|
|
25
|
-
|
|
20
|
+
export {
|
|
21
|
+
JoinedTables as default
|
|
22
|
+
};
|
|
@@ -1,21 +1,20 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
class QueryOrdering {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
2
|
+
_column;
|
|
3
|
+
_direction;
|
|
4
|
+
_nullsPosition;
|
|
5
|
+
constructor(column, direction) {
|
|
6
|
+
this._column = column;
|
|
7
|
+
this._direction = direction;
|
|
8
|
+
}
|
|
9
|
+
nullsFirst() {
|
|
10
|
+
this._nullsPosition = "FIRST";
|
|
11
|
+
return this;
|
|
12
|
+
}
|
|
13
|
+
nullsLast() {
|
|
14
|
+
this._nullsPosition = "LAST";
|
|
15
|
+
return this;
|
|
16
|
+
}
|
|
19
17
|
}
|
|
20
|
-
|
|
21
|
-
|
|
18
|
+
export {
|
|
19
|
+
QueryOrdering as default
|
|
20
|
+
};
|
|
@@ -1,54 +1,51 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
class SelectQuery {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
select
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
return this._queryProcessor(this);
|
|
51
|
-
}
|
|
2
|
+
constructor(_queryProcessor, _tables) {
|
|
3
|
+
this._queryProcessor = _queryProcessor;
|
|
4
|
+
this._tables = _tables;
|
|
5
|
+
}
|
|
6
|
+
_distinct = false;
|
|
7
|
+
_offset;
|
|
8
|
+
_limit;
|
|
9
|
+
_conditions = [];
|
|
10
|
+
_groupBy = [];
|
|
11
|
+
_having = [];
|
|
12
|
+
_orderings = [];
|
|
13
|
+
_columns = [];
|
|
14
|
+
_action;
|
|
15
|
+
offset(offset) {
|
|
16
|
+
this._offset = offset;
|
|
17
|
+
return this;
|
|
18
|
+
}
|
|
19
|
+
limit(limit) {
|
|
20
|
+
this._limit = limit;
|
|
21
|
+
return this;
|
|
22
|
+
}
|
|
23
|
+
distinct() {
|
|
24
|
+
this._distinct = true;
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
where(...conditions) {
|
|
28
|
+
this._conditions = conditions;
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
groupBy(...columns) {
|
|
32
|
+
this._groupBy = columns;
|
|
33
|
+
return this;
|
|
34
|
+
}
|
|
35
|
+
having(...conditions) {
|
|
36
|
+
this._having = conditions;
|
|
37
|
+
return this;
|
|
38
|
+
}
|
|
39
|
+
orderBy(...orderings) {
|
|
40
|
+
this._orderings = orderings;
|
|
41
|
+
return this;
|
|
42
|
+
}
|
|
43
|
+
select(...columns) {
|
|
44
|
+
this._columns = columns;
|
|
45
|
+
this._action = "select";
|
|
46
|
+
return this._queryProcessor(this);
|
|
47
|
+
}
|
|
52
48
|
}
|
|
53
|
-
|
|
54
|
-
|
|
49
|
+
export {
|
|
50
|
+
SelectQuery as default
|
|
51
|
+
};
|
|
@@ -1,31 +1,27 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
1
|
class TableConditionQuery {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
this._action = 'select';
|
|
27
|
-
return this._queryProcessor(this).then((rows) => rows[0]);
|
|
28
|
-
}
|
|
2
|
+
constructor(_queryProcessor, _table, _conditions) {
|
|
3
|
+
this._queryProcessor = _queryProcessor;
|
|
4
|
+
this._table = _table;
|
|
5
|
+
this._conditions = _conditions;
|
|
6
|
+
}
|
|
7
|
+
_columns = [];
|
|
8
|
+
_action;
|
|
9
|
+
_entity;
|
|
10
|
+
update(entity) {
|
|
11
|
+
this._entity = entity;
|
|
12
|
+
this._action = "update";
|
|
13
|
+
return this._queryProcessor(this);
|
|
14
|
+
}
|
|
15
|
+
delete() {
|
|
16
|
+
this._action = "delete";
|
|
17
|
+
return this._queryProcessor(this);
|
|
18
|
+
}
|
|
19
|
+
count() {
|
|
20
|
+
this._columns = [this._table.$all.count()];
|
|
21
|
+
this._action = "select";
|
|
22
|
+
return this._queryProcessor(this).then((rows) => rows[0]);
|
|
23
|
+
}
|
|
29
24
|
}
|
|
30
|
-
|
|
31
|
-
|
|
25
|
+
export {
|
|
26
|
+
TableConditionQuery as default
|
|
27
|
+
};
|
|
@@ -1,60 +1,54 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const table_condition_query_1 = require("./table-condition-query");
|
|
4
|
-
const value_column_1 = require("../column/value-column");
|
|
1
|
+
import TableConditionQuery from "./table-condition-query";
|
|
2
|
+
import ValueColumn from "../column/value-column";
|
|
5
3
|
class TableQuery {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
insert
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
}
|
|
54
|
-
else {
|
|
55
|
-
return this.where(...Object.keys($id).map(key => this._table[key].eq(id[key])));
|
|
56
|
-
}
|
|
57
|
-
}
|
|
4
|
+
constructor(_queryProcessor, _table) {
|
|
5
|
+
this._queryProcessor = _queryProcessor;
|
|
6
|
+
this._table = _table;
|
|
7
|
+
}
|
|
8
|
+
_entity;
|
|
9
|
+
_action;
|
|
10
|
+
_columns = [];
|
|
11
|
+
where(...conditions) {
|
|
12
|
+
return new TableConditionQuery(this._queryProcessor, this._table, conditions);
|
|
13
|
+
}
|
|
14
|
+
insert(param) {
|
|
15
|
+
this._entity = param;
|
|
16
|
+
this._action = "insert";
|
|
17
|
+
return this._queryProcessor(this);
|
|
18
|
+
}
|
|
19
|
+
deleteAll() {
|
|
20
|
+
this._action = "delete";
|
|
21
|
+
return this._queryProcessor(this);
|
|
22
|
+
}
|
|
23
|
+
updateAll(entity) {
|
|
24
|
+
this._entity = entity;
|
|
25
|
+
this._action = "update";
|
|
26
|
+
return this._queryProcessor(this);
|
|
27
|
+
}
|
|
28
|
+
countAll() {
|
|
29
|
+
this._columns = [this._table.$all.count()];
|
|
30
|
+
this._action = "select";
|
|
31
|
+
return this._queryProcessor(this).then((rows) => rows[0]);
|
|
32
|
+
}
|
|
33
|
+
delete(id) {
|
|
34
|
+
return this._whereId(id).delete().then((count) => count > 0);
|
|
35
|
+
}
|
|
36
|
+
update(id, entity) {
|
|
37
|
+
return this._whereId(id).update(entity).then((count) => count > 0);
|
|
38
|
+
}
|
|
39
|
+
get(id) {
|
|
40
|
+
let query = this._whereId(id);
|
|
41
|
+
return this._queryProcessor({ _action: "select", ...query }).then((rows) => rows[0]);
|
|
42
|
+
}
|
|
43
|
+
_whereId(id) {
|
|
44
|
+
let $id = this._table.$id;
|
|
45
|
+
if ($id instanceof ValueColumn) {
|
|
46
|
+
return this.where($id.eq(id));
|
|
47
|
+
} else {
|
|
48
|
+
return this.where(...Object.keys($id).map((key) => this._table[key].eq(id[key])));
|
|
49
|
+
}
|
|
50
|
+
}
|
|
58
51
|
}
|
|
59
|
-
|
|
60
|
-
|
|
52
|
+
export {
|
|
53
|
+
TableQuery as default
|
|
54
|
+
};
|
|
@@ -1,22 +1,18 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const select_query_1 = require("./query/select-query");
|
|
4
|
-
const table_query_1 = require("./query/table-query");
|
|
1
|
+
import SelectQuery from "./query/select-query";
|
|
2
|
+
import TableQuery from "./query/table-query";
|
|
5
3
|
class QuerySource {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
table(table) {
|
|
18
|
-
return new table_query_1.default(this._queryProcessor, table);
|
|
19
|
-
}
|
|
4
|
+
constructor(_queryProcessor) {
|
|
5
|
+
this._queryProcessor = _queryProcessor;
|
|
6
|
+
}
|
|
7
|
+
from(table1, table2, table3) {
|
|
8
|
+
if (table3 != null) return new SelectQuery(this._queryProcessor, [table1, table2, table3]);
|
|
9
|
+
else if (table2 != null) return new SelectQuery(this._queryProcessor, [table1, table2]);
|
|
10
|
+
return new SelectQuery(this._queryProcessor, [table1]);
|
|
11
|
+
}
|
|
12
|
+
table(table) {
|
|
13
|
+
return new TableQuery(this._queryProcessor, table);
|
|
14
|
+
}
|
|
20
15
|
}
|
|
21
|
-
|
|
22
|
-
|
|
16
|
+
export {
|
|
17
|
+
QuerySource as default
|
|
18
|
+
};
|
|
@@ -1,28 +1,27 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
const basic_column_1 = require("./column/basic-column");
|
|
4
|
-
const joined_tables_chain_1 = require("./join/joined-tables-chain");
|
|
1
|
+
import BasicColumn from "./column/basic-column";
|
|
2
|
+
import JoinedTablesChain from "./join/joined-tables-chain";
|
|
5
3
|
class QueryTable {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
}
|
|
4
|
+
constructor(_$name) {
|
|
5
|
+
this._$name = _$name;
|
|
6
|
+
}
|
|
7
|
+
_$type;
|
|
8
|
+
_$idType;
|
|
9
|
+
// abstract readonly $id; // FIXME I got a dozen incomprehensible type errors
|
|
10
|
+
$all = new BasicColumn(this, "*");
|
|
11
|
+
innerJoin(table) {
|
|
12
|
+
return new JoinedTablesChain(table, "inner", this);
|
|
13
|
+
}
|
|
14
|
+
leftJoin(table) {
|
|
15
|
+
return new JoinedTablesChain(table, "left", this);
|
|
16
|
+
}
|
|
17
|
+
rightJoin(table) {
|
|
18
|
+
return new JoinedTablesChain(table, "right", this);
|
|
19
|
+
}
|
|
20
|
+
fullJoin(table) {
|
|
21
|
+
return new JoinedTablesChain(table, "full", this);
|
|
22
|
+
}
|
|
26
23
|
}
|
|
27
|
-
|
|
28
|
-
|
|
24
|
+
var query_table_default = QueryTable;
|
|
25
|
+
export {
|
|
26
|
+
query_table_default as default
|
|
27
|
+
};
|
package/lib-prod/client/mysql.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
super((0, query_processor_1.createQueryProcessor)(client, options, 'mysql'));
|
|
8
|
-
}
|
|
1
|
+
import QuerySource from "../builder/query-source";
|
|
2
|
+
import { createQueryProcessor } from "./query-processor";
|
|
3
|
+
class MySqlQuerySource extends QuerySource {
|
|
4
|
+
constructor(client, options = {}) {
|
|
5
|
+
super(createQueryProcessor(client, options, "mysql"));
|
|
6
|
+
}
|
|
9
7
|
}
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export {
|
|
9
|
+
MySqlQuerySource as default
|
|
10
|
+
};
|
package/lib-prod/client/pg.js
CHANGED
|
@@ -1,11 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
super((0, query_processor_1.createQueryProcessor)(client, options, 'pg'));
|
|
8
|
-
}
|
|
1
|
+
import QuerySource from "../builder/query-source";
|
|
2
|
+
import { createQueryProcessor } from "./query-processor";
|
|
3
|
+
class PgQuerySource extends QuerySource {
|
|
4
|
+
constructor(client, options = {}) {
|
|
5
|
+
super(createQueryProcessor(client, options, "pg"));
|
|
6
|
+
}
|
|
9
7
|
}
|
|
10
|
-
|
|
11
|
-
|
|
8
|
+
export {
|
|
9
|
+
PgQuerySource as default
|
|
10
|
+
};
|