taon-type-sql 21.0.68 → 21.0.70
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/VERIFIED-BUILD-DATA.jsonc +3 -3
- package/browser/package.json +1 -1
- package/browser-prod/package.json +1 -1
- package/full-dts/build-info._auto-generated_.d.ts +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-esm/lib/build-info._auto-generated_.d.ts +1 -1
- package/lib-esm/lib/build-info._auto-generated_.js +1 -1
- package/lib-prod/build-info._auto-generated_.d.ts +1 -1
- package/lib-prod/build-info._auto-generated_.js +1 -1
- package/lib-prod/package.json +1 -1
- package/package.json +1 -1
- package/ts-source/browser-code/build-info._auto-generated_.ts +18 -0
- package/ts-source/browser-code/builder/column/basic-column.ts +24 -0
- package/ts-source/browser-code/builder/column/boolean-column.ts +25 -0
- package/ts-source/browser-code/builder/column/comparable-column.ts +52 -0
- package/ts-source/browser-code/builder/column/date-column.ts +25 -0
- package/ts-source/browser-code/builder/column/number-column.ts +30 -0
- package/ts-source/browser-code/builder/column/query-column.ts +33 -0
- package/ts-source/browser-code/builder/column/string-column.ts +47 -0
- package/ts-source/browser-code/builder/column/value-column.ts +44 -0
- package/ts-source/browser-code/builder/condition/query-column-condition.ts +34 -0
- package/ts-source/browser-code/builder/condition/query-condition-chain.ts +44 -0
- package/ts-source/browser-code/builder/condition/query-condition.ts +19 -0
- package/ts-source/browser-code/builder/condition/query-join-condition.ts +33 -0
- package/ts-source/browser-code/builder/helpers/generics-helper.ts +14 -0
- package/ts-source/browser-code/builder/helpers/internal-types.ts +27 -0
- package/ts-source/browser-code/builder/join/joined-tables-chain.ts +22 -0
- package/ts-source/browser-code/builder/join/joined-tables.ts +30 -0
- package/ts-source/browser-code/builder/other/query-ordering.ts +31 -0
- package/ts-source/browser-code/builder/query/select-query.ts +65 -0
- package/ts-source/browser-code/builder/query/table-condition-query.ts +36 -0
- package/ts-source/browser-code/builder/query/table-query.ts +68 -0
- package/ts-source/browser-code/builder/query-source.ts +34 -0
- package/ts-source/browser-code/builder/query-table.ts +34 -0
- package/ts-source/browser-code/client/mysql.ts +19 -0
- package/ts-source/browser-code/client/pg.ts +19 -0
- package/ts-source/browser-code/client/query-processor.ts +65 -0
- package/ts-source/browser-code/converter/param-converter.ts +36 -0
- package/ts-source/browser-code/converter/parameterized-converter.ts +27 -0
- package/ts-source/browser-code/converter/query-converter.ts +292 -0
- package/ts-source/browser-code/converter/result-converter.ts +98 -0
- package/ts-source/browser-code/converter/sql-converter.ts +18 -0
- package/ts-source/browser-code/converter/type-converter.ts +48 -0
- package/ts-source/browser-code/converter/types.ts +17 -0
- package/ts-source/browser-code/index._auto-generated_.ts +12 -0
- package/ts-source/browser-code/index.scss +11 -0
- package/ts-source/browser-code/index.ts +37 -0
- package/ts-source/browser-code/lib-info.md +8 -0
- package/ts-source/browser-code/migrations/index.ts +13 -0
- package/ts-source/browser-code/migrations/migrations-info.md +6 -0
- package/ts-source/browser-code/migrations/migrations_index._auto-generated_.ts +12 -0
- package/ts-source/browser-code-prod/build-info._auto-generated_.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/build-info._auto-generated_.ts +18 -0
- package/ts-source/browser-code-prod/builder/column/basic-column.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/column/basic-column.ts +24 -0
- package/ts-source/browser-code-prod/builder/column/boolean-column.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/column/boolean-column.ts +25 -0
- package/ts-source/browser-code-prod/builder/column/comparable-column.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/column/comparable-column.ts +52 -0
- package/ts-source/browser-code-prod/builder/column/date-column.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/column/date-column.ts +25 -0
- package/ts-source/browser-code-prod/builder/column/number-column.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/column/number-column.ts +30 -0
- package/ts-source/browser-code-prod/builder/column/query-column.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/column/query-column.ts +33 -0
- package/ts-source/browser-code-prod/builder/column/string-column.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/column/string-column.ts +47 -0
- package/ts-source/browser-code-prod/builder/column/value-column.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/column/value-column.ts +44 -0
- package/ts-source/browser-code-prod/builder/condition/query-column-condition.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/condition/query-column-condition.ts +34 -0
- package/ts-source/browser-code-prod/builder/condition/query-condition-chain.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/condition/query-condition-chain.ts +44 -0
- package/ts-source/browser-code-prod/builder/condition/query-condition.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/condition/query-condition.ts +19 -0
- package/ts-source/browser-code-prod/builder/condition/query-join-condition.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/condition/query-join-condition.ts +33 -0
- package/ts-source/browser-code-prod/builder/helpers/generics-helper.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/helpers/generics-helper.ts +14 -0
- package/ts-source/browser-code-prod/builder/helpers/internal-types.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/helpers/internal-types.ts +27 -0
- package/ts-source/browser-code-prod/builder/join/joined-tables-chain.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/join/joined-tables-chain.ts +22 -0
- package/ts-source/browser-code-prod/builder/join/joined-tables.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/join/joined-tables.ts +30 -0
- package/ts-source/browser-code-prod/builder/other/query-ordering.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/other/query-ordering.ts +31 -0
- package/ts-source/browser-code-prod/builder/query/select-query.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/query/select-query.ts +65 -0
- package/ts-source/browser-code-prod/builder/query/table-condition-query.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/query/table-condition-query.ts +36 -0
- package/ts-source/browser-code-prod/builder/query/table-query.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/query/table-query.ts +68 -0
- package/ts-source/browser-code-prod/builder/query-source.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/query-source.ts +34 -0
- package/ts-source/browser-code-prod/builder/query-table.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/builder/query-table.ts +34 -0
- package/ts-source/browser-code-prod/client/mysql.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/client/mysql.ts +19 -0
- package/ts-source/browser-code-prod/client/pg.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/client/pg.ts +19 -0
- package/ts-source/browser-code-prod/client/query-processor.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/client/query-processor.ts +65 -0
- package/ts-source/browser-code-prod/converter/param-converter.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/converter/param-converter.ts +36 -0
- package/ts-source/browser-code-prod/converter/parameterized-converter.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/converter/parameterized-converter.ts +27 -0
- package/ts-source/browser-code-prod/converter/query-converter.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/converter/query-converter.ts +292 -0
- package/ts-source/browser-code-prod/converter/result-converter.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/converter/result-converter.ts +98 -0
- package/ts-source/browser-code-prod/converter/sql-converter.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/converter/sql-converter.ts +18 -0
- package/ts-source/browser-code-prod/converter/type-converter.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/converter/type-converter.ts +48 -0
- package/ts-source/browser-code-prod/converter/types.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/converter/types.ts +17 -0
- package/ts-source/browser-code-prod/index._auto-generated_.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/index._auto-generated_.ts +12 -0
- package/ts-source/browser-code-prod/index.scss +11 -0
- package/ts-source/browser-code-prod/index.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/index.ts +37 -0
- package/ts-source/browser-code-prod/lib-info.md +8 -0
- package/ts-source/browser-code-prod/migrations/index.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/migrations/index.ts +13 -0
- package/ts-source/browser-code-prod/migrations/migrations-info.md +6 -0
- package/ts-source/browser-code-prod/migrations/migrations_index._auto-generated_.split-namespaces.json +4 -0
- package/ts-source/browser-code-prod/migrations/migrations_index._auto-generated_.ts +12 -0
- package/ts-source/websql-code/build-info._auto-generated_.ts +18 -0
- package/ts-source/websql-code/builder/column/basic-column.ts +24 -0
- package/ts-source/websql-code/builder/column/boolean-column.ts +25 -0
- package/ts-source/websql-code/builder/column/comparable-column.ts +52 -0
- package/ts-source/websql-code/builder/column/date-column.ts +25 -0
- package/ts-source/websql-code/builder/column/number-column.ts +30 -0
- package/ts-source/websql-code/builder/column/query-column.ts +33 -0
- package/ts-source/websql-code/builder/column/string-column.ts +47 -0
- package/ts-source/websql-code/builder/column/value-column.ts +44 -0
- package/ts-source/websql-code/builder/condition/query-column-condition.ts +34 -0
- package/ts-source/websql-code/builder/condition/query-condition-chain.ts +44 -0
- package/ts-source/websql-code/builder/condition/query-condition.ts +19 -0
- package/ts-source/websql-code/builder/condition/query-join-condition.ts +33 -0
- package/ts-source/websql-code/builder/helpers/generics-helper.ts +14 -0
- package/ts-source/websql-code/builder/helpers/internal-types.ts +27 -0
- package/ts-source/websql-code/builder/join/joined-tables-chain.ts +22 -0
- package/ts-source/websql-code/builder/join/joined-tables.ts +30 -0
- package/ts-source/websql-code/builder/other/query-ordering.ts +31 -0
- package/ts-source/websql-code/builder/query/select-query.ts +65 -0
- package/ts-source/websql-code/builder/query/table-condition-query.ts +36 -0
- package/ts-source/websql-code/builder/query/table-query.ts +68 -0
- package/ts-source/websql-code/builder/query-source.ts +34 -0
- package/ts-source/websql-code/builder/query-table.ts +34 -0
- package/ts-source/websql-code/client/mysql.ts +19 -0
- package/ts-source/websql-code/client/pg.ts +19 -0
- package/ts-source/websql-code/client/query-processor.ts +65 -0
- package/ts-source/websql-code/converter/param-converter.ts +36 -0
- package/ts-source/websql-code/converter/parameterized-converter.ts +27 -0
- package/ts-source/websql-code/converter/query-converter.ts +292 -0
- package/ts-source/websql-code/converter/result-converter.ts +98 -0
- package/ts-source/websql-code/converter/sql-converter.ts +18 -0
- package/ts-source/websql-code/converter/type-converter.ts +48 -0
- package/ts-source/websql-code/converter/types.ts +17 -0
- package/ts-source/websql-code/index._auto-generated_.ts +12 -0
- package/ts-source/websql-code/index.scss +11 -0
- package/ts-source/websql-code/index.ts +37 -0
- package/ts-source/websql-code/lib-info.md +8 -0
- package/ts-source/websql-code/migrations/index.ts +13 -0
- package/ts-source/websql-code/migrations/migrations-info.md +6 -0
- package/ts-source/websql-code/migrations/migrations_index._auto-generated_.ts +12 -0
- package/ts-source/websql-code-prod/build-info._auto-generated_.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/build-info._auto-generated_.ts +18 -0
- package/ts-source/websql-code-prod/builder/column/basic-column.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/column/basic-column.ts +24 -0
- package/ts-source/websql-code-prod/builder/column/boolean-column.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/column/boolean-column.ts +25 -0
- package/ts-source/websql-code-prod/builder/column/comparable-column.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/column/comparable-column.ts +52 -0
- package/ts-source/websql-code-prod/builder/column/date-column.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/column/date-column.ts +25 -0
- package/ts-source/websql-code-prod/builder/column/number-column.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/column/number-column.ts +30 -0
- package/ts-source/websql-code-prod/builder/column/query-column.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/column/query-column.ts +33 -0
- package/ts-source/websql-code-prod/builder/column/string-column.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/column/string-column.ts +47 -0
- package/ts-source/websql-code-prod/builder/column/value-column.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/column/value-column.ts +44 -0
- package/ts-source/websql-code-prod/builder/condition/query-column-condition.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/condition/query-column-condition.ts +34 -0
- package/ts-source/websql-code-prod/builder/condition/query-condition-chain.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/condition/query-condition-chain.ts +44 -0
- package/ts-source/websql-code-prod/builder/condition/query-condition.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/condition/query-condition.ts +19 -0
- package/ts-source/websql-code-prod/builder/condition/query-join-condition.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/condition/query-join-condition.ts +33 -0
- package/ts-source/websql-code-prod/builder/helpers/generics-helper.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/helpers/generics-helper.ts +14 -0
- package/ts-source/websql-code-prod/builder/helpers/internal-types.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/helpers/internal-types.ts +27 -0
- package/ts-source/websql-code-prod/builder/join/joined-tables-chain.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/join/joined-tables-chain.ts +22 -0
- package/ts-source/websql-code-prod/builder/join/joined-tables.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/join/joined-tables.ts +30 -0
- package/ts-source/websql-code-prod/builder/other/query-ordering.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/other/query-ordering.ts +31 -0
- package/ts-source/websql-code-prod/builder/query/select-query.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/query/select-query.ts +65 -0
- package/ts-source/websql-code-prod/builder/query/table-condition-query.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/query/table-condition-query.ts +36 -0
- package/ts-source/websql-code-prod/builder/query/table-query.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/query/table-query.ts +68 -0
- package/ts-source/websql-code-prod/builder/query-source.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/query-source.ts +34 -0
- package/ts-source/websql-code-prod/builder/query-table.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/builder/query-table.ts +34 -0
- package/ts-source/websql-code-prod/client/mysql.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/client/mysql.ts +19 -0
- package/ts-source/websql-code-prod/client/pg.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/client/pg.ts +19 -0
- package/ts-source/websql-code-prod/client/query-processor.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/client/query-processor.ts +65 -0
- package/ts-source/websql-code-prod/converter/param-converter.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/converter/param-converter.ts +36 -0
- package/ts-source/websql-code-prod/converter/parameterized-converter.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/converter/parameterized-converter.ts +27 -0
- package/ts-source/websql-code-prod/converter/query-converter.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/converter/query-converter.ts +292 -0
- package/ts-source/websql-code-prod/converter/result-converter.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/converter/result-converter.ts +98 -0
- package/ts-source/websql-code-prod/converter/sql-converter.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/converter/sql-converter.ts +18 -0
- package/ts-source/websql-code-prod/converter/type-converter.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/converter/type-converter.ts +48 -0
- package/ts-source/websql-code-prod/converter/types.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/converter/types.ts +17 -0
- package/ts-source/websql-code-prod/index._auto-generated_.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/index._auto-generated_.ts +12 -0
- package/ts-source/websql-code-prod/index.scss +11 -0
- package/ts-source/websql-code-prod/index.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/index.ts +37 -0
- package/ts-source/websql-code-prod/lib-info.md +8 -0
- package/ts-source/websql-code-prod/migrations/index.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/migrations/index.ts +13 -0
- package/ts-source/websql-code-prod/migrations/migrations-info.md +6 -0
- package/ts-source/websql-code-prod/migrations/migrations_index._auto-generated_.split-namespaces.json +4 -0
- package/ts-source/websql-code-prod/migrations/migrations_index._auto-generated_.ts +12 -0
- package/websql/package.json +1 -1
- package/websql-prod/package.json +1 -1
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryTable from "../query-table";
|
|
14
|
+
import QueryColumn from "./query-column";
|
|
15
|
+
import NumberColumn from "./number-column";
|
|
16
|
+
import { ColumnModifier, ColumnName } from "../helpers/internal-types";
|
|
17
|
+
export default class BasicColumn<Table extends QueryTable<any, any>, T> extends QueryColumn<Table, T> {
|
|
18
|
+
constructor(table: Table, name: ColumnName, modifiers: ColumnModifier[] = []) {
|
|
19
|
+
super(table, name, modifiers);
|
|
20
|
+
}
|
|
21
|
+
count(): NumberColumn<Table> {
|
|
22
|
+
return new NumberColumn(this._table, this._name, this._modifiers.concat({ name: 'count' }));
|
|
23
|
+
}
|
|
24
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryTable from "../query-table";
|
|
14
|
+
import NumberColumn from "./number-column";
|
|
15
|
+
import ValueColumn from "./value-column";
|
|
16
|
+
import { ColumnModifier, ColumnName } from "../helpers/internal-types";
|
|
17
|
+
export default class BooleanColumn<Table extends QueryTable<any, any>> extends ValueColumn<Table, boolean> {
|
|
18
|
+
protected _type = 'boolean';
|
|
19
|
+
constructor(table: Table, name: ColumnName, modifiers: ColumnModifier[] = []) {
|
|
20
|
+
super(table, name, modifiers);
|
|
21
|
+
}
|
|
22
|
+
count(): NumberColumn<Table> {
|
|
23
|
+
return new NumberColumn(this._table, this._name, this._modifiers.concat({ name: 'count' }));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryColumnCondition from "../condition/query-column-condition";
|
|
14
|
+
import QueryTable from "../query-table";
|
|
15
|
+
import ValueColumn from "./value-column";
|
|
16
|
+
import { ColumnModifier, ColumnName } from "../helpers/internal-types";
|
|
17
|
+
abstract class ComparableColumn<Table extends QueryTable<any, any>, T> extends ValueColumn<Table, T> {
|
|
18
|
+
constructor(table: Table, name: ColumnName, modifiers: ColumnModifier[] = []) {
|
|
19
|
+
super(table, name, modifiers);
|
|
20
|
+
}
|
|
21
|
+
lt(value: T) {
|
|
22
|
+
return new QueryColumnCondition<Table, T>(this, 'lt', value);
|
|
23
|
+
}
|
|
24
|
+
gt(value: T) {
|
|
25
|
+
return new QueryColumnCondition<Table, T>(this, 'gt', value);
|
|
26
|
+
}
|
|
27
|
+
lte(value: T) {
|
|
28
|
+
return new QueryColumnCondition<Table, T>(this, 'lte', value);
|
|
29
|
+
}
|
|
30
|
+
gte(value: T) {
|
|
31
|
+
return new QueryColumnCondition<Table, T>(this, 'gte', value);
|
|
32
|
+
}
|
|
33
|
+
in(values: T[]) {
|
|
34
|
+
return new QueryColumnCondition<Table, T>(this, 'in', ...values);
|
|
35
|
+
}
|
|
36
|
+
notIn(values: T[]) {
|
|
37
|
+
return new QueryColumnCondition<Table, T>(this, 'not-in', ...values);
|
|
38
|
+
}
|
|
39
|
+
between(value1: T, value2: T) {
|
|
40
|
+
return new QueryColumnCondition<Table, T>(this, 'between', value1, value2);
|
|
41
|
+
}
|
|
42
|
+
notBetween(value1: T, value2: T) {
|
|
43
|
+
return new QueryColumnCondition<Table, T>(this, 'not-between', value1, value2);
|
|
44
|
+
}
|
|
45
|
+
min(): this {
|
|
46
|
+
return new (<any>this.constructor)(this._table, this._name, this._modifiers.concat({ name: 'min' }));
|
|
47
|
+
}
|
|
48
|
+
max(): this {
|
|
49
|
+
return new (<any>this.constructor)(this._table, this._name, this._modifiers.concat({ name: 'max' }));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
export default ComparableColumn;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryTable from "../query-table";
|
|
14
|
+
import ComparableColumn from "./comparable-column";
|
|
15
|
+
import NumberColumn from "./number-column";
|
|
16
|
+
import { ColumnModifier, ColumnName } from "../helpers/internal-types";
|
|
17
|
+
export default class DateColumn<Table extends QueryTable<any, any>> extends ComparableColumn<Table, Date> {
|
|
18
|
+
protected _type = 'date';
|
|
19
|
+
constructor(table: Table, name: ColumnName, modifiers: ColumnModifier[] = []) {
|
|
20
|
+
super(table, name, modifiers);
|
|
21
|
+
}
|
|
22
|
+
count(): NumberColumn<Table> {
|
|
23
|
+
return new NumberColumn(this._table, this._name, this._modifiers.concat({ name: 'count' }));
|
|
24
|
+
}
|
|
25
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryTable from "../query-table";
|
|
14
|
+
import ComparableColumn from "./comparable-column";
|
|
15
|
+
import { ColumnModifier, ColumnName } from "../helpers/internal-types";
|
|
16
|
+
export default class NumberColumn<Table extends QueryTable<any, any>> extends ComparableColumn<Table, number> {
|
|
17
|
+
protected _type = 'number';
|
|
18
|
+
constructor(table: Table, name: ColumnName, modifiers: ColumnModifier[] = []) {
|
|
19
|
+
super(table, name, modifiers);
|
|
20
|
+
}
|
|
21
|
+
count(): NumberColumn<Table> {
|
|
22
|
+
return new NumberColumn(this._table, this._name, this._modifiers.concat({ name: 'count' }));
|
|
23
|
+
}
|
|
24
|
+
sum(): NumberColumn<Table> {
|
|
25
|
+
return new NumberColumn<Table>(this._table, this._name, this._modifiers.concat({ name: 'sum' }));
|
|
26
|
+
}
|
|
27
|
+
avg(): NumberColumn<Table> {
|
|
28
|
+
return new NumberColumn<Table>(this._table, this._name, this._modifiers.concat({ name: 'avg' }));
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryTable from "../query-table";
|
|
14
|
+
import NumberColumn from "./number-column";
|
|
15
|
+
import GenericsHelper from "../helpers/generics-helper";
|
|
16
|
+
import QueryColumnCondition from "../condition/query-column-condition";
|
|
17
|
+
import { ColumnModifier, ColumnName } from "../helpers/internal-types";
|
|
18
|
+
abstract class QueryColumn<Table extends QueryTable<any, any>, T> {
|
|
19
|
+
protected _$type: GenericsHelper<T>;
|
|
20
|
+
protected _type: string;
|
|
21
|
+
constructor(protected _table: Table, protected _name: ColumnName, protected _modifiers: ColumnModifier[] = []) { }
|
|
22
|
+
abstract count(): NumberColumn<Table>;
|
|
23
|
+
as(alias: string): this {
|
|
24
|
+
return new (<any>this.constructor)(this._table, this._name, this._modifiers.concat({ name: 'as', params: alias }));
|
|
25
|
+
}
|
|
26
|
+
isNull() {
|
|
27
|
+
return new QueryColumnCondition<Table, T>(this, 'is-null');
|
|
28
|
+
}
|
|
29
|
+
isNotNull() {
|
|
30
|
+
return new QueryColumnCondition<Table, T>(this, 'is-not-null');
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
export default QueryColumn;
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryTable from "../query-table";
|
|
14
|
+
import ComparableColumn from "./comparable-column";
|
|
15
|
+
import NumberColumn from "./number-column";
|
|
16
|
+
import QueryColumnCondition from "../condition/query-column-condition";
|
|
17
|
+
import { ColumnModifier, ColumnName } from "../helpers/internal-types";
|
|
18
|
+
export default class StringColumn<Table extends QueryTable<any, any>> extends ComparableColumn<Table, string> {
|
|
19
|
+
protected _type = 'string';
|
|
20
|
+
constructor(table: Table, name: ColumnName, modifiers: ColumnModifier[] = []) {
|
|
21
|
+
super(table, name, modifiers);
|
|
22
|
+
}
|
|
23
|
+
count(): NumberColumn<Table> {
|
|
24
|
+
return new NumberColumn(this._table, this._name, this._modifiers.concat({ name: 'count' }));
|
|
25
|
+
}
|
|
26
|
+
lower(): this {
|
|
27
|
+
return new (<any>this.constructor)(this._table, this._name, this._modifiers.concat({ name: 'lower' }));
|
|
28
|
+
}
|
|
29
|
+
upper(): this {
|
|
30
|
+
return new (<any>this.constructor)(this._table, this._name, this._modifiers.concat({ name: 'upper' }));
|
|
31
|
+
}
|
|
32
|
+
contains(value: string) {
|
|
33
|
+
return this.like('%' + value + '%');
|
|
34
|
+
}
|
|
35
|
+
startsWith(value: string) {
|
|
36
|
+
return this.like(value + '%');
|
|
37
|
+
}
|
|
38
|
+
endsWith(value: string) {
|
|
39
|
+
return this.like('%' + value);
|
|
40
|
+
}
|
|
41
|
+
like(value: string) {
|
|
42
|
+
return new QueryColumnCondition<Table, string>(this, 'like', value);
|
|
43
|
+
}
|
|
44
|
+
notLike(value: string) {
|
|
45
|
+
return new QueryColumnCondition<Table, string>(this, 'not-like', value);
|
|
46
|
+
}
|
|
47
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryColumnCondition from "../condition/query-column-condition";
|
|
14
|
+
import QueryOrdering from "../other/query-ordering";
|
|
15
|
+
import QueryTable from "../query-table";
|
|
16
|
+
import QueryColumn from "./query-column";
|
|
17
|
+
import QueryCondition from "../condition/query-condition";
|
|
18
|
+
import QueryJoinCondition from "../condition/query-join-condition";
|
|
19
|
+
import { ColumnModifier, ColumnName } from "../helpers/internal-types";
|
|
20
|
+
abstract class ValueColumn<Table extends QueryTable<any, any>, T> extends QueryColumn<Table, T> {
|
|
21
|
+
constructor(table: Table, name: ColumnName, modifiers: ColumnModifier[] = []) {
|
|
22
|
+
super(table, name, modifiers);
|
|
23
|
+
}
|
|
24
|
+
asc() {
|
|
25
|
+
return new QueryOrdering<Table>(this, 'ASC');
|
|
26
|
+
}
|
|
27
|
+
desc() {
|
|
28
|
+
return new QueryOrdering<Table>(this, 'DESC');
|
|
29
|
+
}
|
|
30
|
+
eq<Table2 extends QueryTable<any, any>>(value: QueryColumn<Table2, T>): QueryJoinCondition<Table, Table2, T>;
|
|
31
|
+
eq(value: T): QueryColumnCondition<Table, T>;
|
|
32
|
+
eq<Table2 extends QueryTable<any, any>>(value: any): QueryCondition<any> {
|
|
33
|
+
if (value instanceof QueryColumn) {
|
|
34
|
+
return new QueryJoinCondition<Table, Table2, T>(this, 'eq', value);
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
return new QueryColumnCondition<Table, T>(this, 'eq', value);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
ne(value: T) {
|
|
41
|
+
return new QueryColumnCondition<Table, T>(this, 'ne', value);
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
export default ValueColumn;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryColumn from "../column/query-column";
|
|
14
|
+
import QueryTable from "../query-table";
|
|
15
|
+
import QueryCondition from "./query-condition";
|
|
16
|
+
import QueryConditionChain from "./query-condition-chain";
|
|
17
|
+
import { ConditionType } from "../helpers/internal-types";
|
|
18
|
+
export default class QueryColumnCondition<Table extends QueryTable<any, any>, T> extends QueryCondition<Table> {
|
|
19
|
+
protected _column: QueryColumn<Table, T>;
|
|
20
|
+
protected _type: ConditionType;
|
|
21
|
+
protected _values: T[];
|
|
22
|
+
constructor(column: QueryColumn<Table, T>, type: ConditionType, ...values: T[]) {
|
|
23
|
+
super();
|
|
24
|
+
this._column = column;
|
|
25
|
+
this._type = type;
|
|
26
|
+
this._values = values;
|
|
27
|
+
}
|
|
28
|
+
and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2> {
|
|
29
|
+
return new QueryConditionChain<Table | Table2>(this, condition, 'and');
|
|
30
|
+
}
|
|
31
|
+
or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2> {
|
|
32
|
+
return new QueryConditionChain<Table | Table2>(this, condition, 'or');
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryTable from "../query-table";
|
|
14
|
+
import QueryCondition from "./query-condition";
|
|
15
|
+
import GenericsHelper from "../helpers/generics-helper";
|
|
16
|
+
import { ConditionChainType } from "../helpers/internal-types";
|
|
17
|
+
export default class QueryConditionChain<Table extends QueryTable<any, any>> extends QueryCondition<Table> {
|
|
18
|
+
protected _$type: GenericsHelper<Table>;
|
|
19
|
+
protected _sibling: QueryCondition<any>;
|
|
20
|
+
protected _child: QueryCondition<any>;
|
|
21
|
+
protected _chainType: ConditionChainType;
|
|
22
|
+
protected _parenthesis = false;
|
|
23
|
+
protected _negation = false;
|
|
24
|
+
constructor(sibling: QueryCondition<any>, child: QueryCondition<any>, chainType: ConditionChainType) {
|
|
25
|
+
super();
|
|
26
|
+
this._sibling = sibling;
|
|
27
|
+
this._child = child;
|
|
28
|
+
this._chainType = chainType;
|
|
29
|
+
}
|
|
30
|
+
$() {
|
|
31
|
+
this._parenthesis = true;
|
|
32
|
+
return this;
|
|
33
|
+
}
|
|
34
|
+
not() {
|
|
35
|
+
this._negation = true;
|
|
36
|
+
return this;
|
|
37
|
+
}
|
|
38
|
+
and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2> {
|
|
39
|
+
return new QueryConditionChain<Table | Table2>(this, condition, 'and');
|
|
40
|
+
}
|
|
41
|
+
or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2> {
|
|
42
|
+
return new QueryConditionChain<Table | Table2>(this, condition, 'or');
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryTable from "../query-table";
|
|
14
|
+
import QueryConditionChain from "./query-condition-chain";
|
|
15
|
+
abstract class QueryCondition<Table extends QueryTable<any, any>> {
|
|
16
|
+
abstract and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
|
|
17
|
+
abstract or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
|
|
18
|
+
}
|
|
19
|
+
export default QueryCondition;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryColumn from "../column/query-column";
|
|
14
|
+
import QueryTable from "../query-table";
|
|
15
|
+
import QueryCondition from "./query-condition";
|
|
16
|
+
import QueryConditionChain from "./query-condition-chain";
|
|
17
|
+
export default class QueryJoinCondition<Table1 extends QueryTable<any, any>, Table2 extends QueryTable<any, any>, T> extends QueryCondition<Table1 | Table2> {
|
|
18
|
+
protected _column: QueryColumn<Table1, T>;
|
|
19
|
+
protected _type: string;
|
|
20
|
+
protected _otherColumn: QueryColumn<Table2, T>;
|
|
21
|
+
constructor(column: QueryColumn<Table1, T>, type: string, otherColumn: QueryColumn<Table2, T>) {
|
|
22
|
+
super();
|
|
23
|
+
this._column = column;
|
|
24
|
+
this._type = type;
|
|
25
|
+
this._otherColumn = otherColumn;
|
|
26
|
+
}
|
|
27
|
+
and<Table3 extends QueryTable<any, any>>(condition: QueryCondition<Table3>): QueryConditionChain<Table1 | Table2 | Table3> {
|
|
28
|
+
return new QueryConditionChain<Table1 | Table2 | Table3>(this, condition, 'and');
|
|
29
|
+
}
|
|
30
|
+
or<Table3 extends QueryTable<any, any>>(condition: QueryCondition<Table3>): QueryConditionChain<Table1 | Table2 | Table3> {
|
|
31
|
+
return new QueryConditionChain<Table1 | Table2 | Table3>(this, condition, 'or');
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
export default class GenericsHelper<T> {
|
|
14
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
export type QueryAction = 'select' | 'insert' | 'update' | 'delete';
|
|
14
|
+
export type ColumnModifierType = 'as' | 'count' | 'min' | 'min' | 'max' | 'sum' | 'avg' | 'lower' | 'upper';
|
|
15
|
+
export interface ColumnModifier {
|
|
16
|
+
name: ColumnModifierType;
|
|
17
|
+
params?: any;
|
|
18
|
+
}
|
|
19
|
+
export type ColumnName = string | {
|
|
20
|
+
name: string;
|
|
21
|
+
alias: string;
|
|
22
|
+
};
|
|
23
|
+
export type ColumnType = 'boolean' | 'number' | 'string' | 'date';
|
|
24
|
+
export type ConditionChainType = 'or' | 'and';
|
|
25
|
+
export type ConditionType = 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'in' | 'not-in' | 'between' | 'not-between' | 'like' | 'not-like' | 'is-null' | 'is-not-null';
|
|
26
|
+
export type JoinType = 'inner' | 'left' | 'right' | 'full';
|
|
27
|
+
export type QueryProcessor = (query: any) => Promise<any>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryTable from "../query-table";
|
|
14
|
+
import QueryJoinCondition from "../condition/query-join-condition";
|
|
15
|
+
import JoinedTables from "./joined-tables";
|
|
16
|
+
import { JoinType } from "../helpers/internal-types";
|
|
17
|
+
export default class JoinedTablesChain<Tables extends QueryTable<any, any>> {
|
|
18
|
+
constructor(protected _table: QueryTable<any, any>, protected _modifier: JoinType, protected _parent: JoinedTables<Tables> | QueryTable<any, any>) { }
|
|
19
|
+
on(condition: QueryJoinCondition<Tables, Tables, any>): JoinedTables<Tables> {
|
|
20
|
+
return new JoinedTables(condition, this);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryTable from "../query-table";
|
|
14
|
+
import JoinedTablesChain from "./joined-tables-chain";
|
|
15
|
+
import QueryJoinCondition from "../condition/query-join-condition";
|
|
16
|
+
export default class JoinedTables<Tables extends QueryTable<any, any>> {
|
|
17
|
+
constructor(protected _condition: QueryJoinCondition<Tables, Tables, any>, protected _parent: JoinedTablesChain<Tables>) { }
|
|
18
|
+
innerJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable> {
|
|
19
|
+
return new JoinedTablesChain(table, 'inner', this);
|
|
20
|
+
}
|
|
21
|
+
leftJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable> {
|
|
22
|
+
return new JoinedTablesChain(table, 'left', this);
|
|
23
|
+
}
|
|
24
|
+
rightJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable> {
|
|
25
|
+
return new JoinedTablesChain(table, 'right', this);
|
|
26
|
+
}
|
|
27
|
+
fullJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable> {
|
|
28
|
+
return new JoinedTablesChain(table, 'full', this);
|
|
29
|
+
}
|
|
30
|
+
}
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryColumn from "../column/query-column";
|
|
14
|
+
import QueryTable from "../query-table";
|
|
15
|
+
export default class QueryOrdering<Table extends QueryTable<any, any>> {
|
|
16
|
+
protected _column: QueryColumn<Table, any>;
|
|
17
|
+
protected _direction: 'ASC' | 'DESC';
|
|
18
|
+
protected _nullsPosition: 'FIRST' | 'LAST';
|
|
19
|
+
constructor(column: QueryColumn<Table, any>, direction: 'ASC' | 'DESC') {
|
|
20
|
+
this._column = column;
|
|
21
|
+
this._direction = direction;
|
|
22
|
+
}
|
|
23
|
+
nullsFirst(): this {
|
|
24
|
+
this._nullsPosition = 'FIRST';
|
|
25
|
+
return this;
|
|
26
|
+
}
|
|
27
|
+
nullsLast(): this {
|
|
28
|
+
this._nullsPosition = 'LAST';
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
}
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryCondition from "../condition/query-condition";
|
|
14
|
+
import QueryOrdering from "../other/query-ordering";
|
|
15
|
+
import QueryTable from "../query-table";
|
|
16
|
+
import QueryColumn from "../column/query-column";
|
|
17
|
+
import { QueryProcessor, QueryAction } from "../helpers/internal-types";
|
|
18
|
+
export default class SelectQuery<Entity, Table extends QueryTable<Entity, any>> {
|
|
19
|
+
constructor(protected _queryProcessor: QueryProcessor, protected _tables: Table[]) { }
|
|
20
|
+
protected _distinct = false;
|
|
21
|
+
protected _offset: number;
|
|
22
|
+
protected _limit: number;
|
|
23
|
+
protected _conditions: QueryCondition<Table>[] = [];
|
|
24
|
+
protected _groupBy: QueryColumn<Table, any>[] = [];
|
|
25
|
+
protected _having: QueryCondition<Table>[] = [];
|
|
26
|
+
protected _orderings: (QueryColumn<Table, any> | QueryOrdering<Table>)[] = [];
|
|
27
|
+
protected _columns: QueryColumn<Table, any>[] = [];
|
|
28
|
+
protected _action: QueryAction;
|
|
29
|
+
offset(offset: number): this {
|
|
30
|
+
this._offset = offset;
|
|
31
|
+
return this;
|
|
32
|
+
}
|
|
33
|
+
limit(limit: number): this {
|
|
34
|
+
this._limit = limit;
|
|
35
|
+
return this;
|
|
36
|
+
}
|
|
37
|
+
distinct(): this {
|
|
38
|
+
this._distinct = true;
|
|
39
|
+
return this;
|
|
40
|
+
}
|
|
41
|
+
where(...conditions: QueryCondition<Table>[]): this {
|
|
42
|
+
this._conditions = conditions;
|
|
43
|
+
return this;
|
|
44
|
+
}
|
|
45
|
+
groupBy(...columns: QueryColumn<Table, any>[]): this {
|
|
46
|
+
this._groupBy = columns;
|
|
47
|
+
return this;
|
|
48
|
+
}
|
|
49
|
+
having(...conditions: QueryCondition<Table>[]): this {
|
|
50
|
+
this._having = conditions;
|
|
51
|
+
return this;
|
|
52
|
+
}
|
|
53
|
+
orderBy(...orderings: (QueryColumn<Table, any> | QueryOrdering<Table>)[]): this {
|
|
54
|
+
this._orderings = orderings;
|
|
55
|
+
return this;
|
|
56
|
+
}
|
|
57
|
+
select(): Promise<Entity[]>;
|
|
58
|
+
select<T>(column: QueryColumn<Table, T>): Promise<T[]>;
|
|
59
|
+
select(...columns: QueryColumn<Table, any>[]): Promise<any[]>;
|
|
60
|
+
select(...columns: QueryColumn<Table, any>[]): Promise<any[]> {
|
|
61
|
+
this._columns = columns;
|
|
62
|
+
this._action = 'select';
|
|
63
|
+
return this._queryProcessor(this);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// @ts-nocheck
|
|
2
|
+
/* ============================================================================
|
|
3
|
+
|
|
4
|
+
- TAON READONLY SOURCE
|
|
5
|
+
- DO NOT MODIFY THIS FILE.
|
|
6
|
+
- Changes may be overwritten.
|
|
7
|
+
- Use command: taon build:lib:watch
|
|
8
|
+
inside taon-type-sql project repository
|
|
9
|
+
for watch development of third party modules like this.
|
|
10
|
+
|
|
11
|
+
* ========================================================================== */
|
|
12
|
+
|
|
13
|
+
import QueryTable from "../query-table";
|
|
14
|
+
import QueryCondition from "../condition/query-condition";
|
|
15
|
+
import QueryColumn from "../column/query-column";
|
|
16
|
+
import { QueryProcessor, QueryAction } from "../helpers/internal-types";
|
|
17
|
+
export default class TableConditionQuery<Entity, Table extends QueryTable<Entity, any>> {
|
|
18
|
+
constructor(protected _queryProcessor: QueryProcessor, protected _table: Table, protected _conditions: QueryCondition<Table>[]) { }
|
|
19
|
+
protected _columns: QueryColumn<Table, any>[] = [];
|
|
20
|
+
protected _action: QueryAction;
|
|
21
|
+
protected _entity: Entity | Partial<Entity>;
|
|
22
|
+
update(entity: Partial<Entity>): Promise<number> {
|
|
23
|
+
this._entity = entity;
|
|
24
|
+
this._action = 'update';
|
|
25
|
+
return this._queryProcessor(this);
|
|
26
|
+
}
|
|
27
|
+
delete(): Promise<number> {
|
|
28
|
+
this._action = 'delete';
|
|
29
|
+
return this._queryProcessor(this);
|
|
30
|
+
}
|
|
31
|
+
count(): Promise<number> {
|
|
32
|
+
this._columns = [this._table.$all.count()];
|
|
33
|
+
this._action = 'select';
|
|
34
|
+
return this._queryProcessor(this).then((rows: number[]) => rows[0]);
|
|
35
|
+
}
|
|
36
|
+
}
|