taon-type-sql 21.0.22 → 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.
Files changed (99) hide show
  1. package/browser/package.json +1 -1
  2. package/browser-prod/package.json +1 -1
  3. package/lib/build-info._auto-generated_.d.ts +1 -1
  4. package/lib/build-info._auto-generated_.js +1 -1
  5. package/lib/package.json +1 -1
  6. package/lib-prod/build-info._auto-generated_.js +14 -0
  7. package/lib-prod/builder/column/basic-column.js +13 -0
  8. package/lib-prod/builder/column/boolean-column.js +14 -0
  9. package/lib-prod/builder/column/comparable-column.js +42 -0
  10. package/lib-prod/builder/column/date-column.js +14 -0
  11. package/lib-prod/builder/column/number-column.js +19 -0
  12. package/lib-prod/builder/column/query-column.js +24 -0
  13. package/lib-prod/builder/column/string-column.js +36 -0
  14. package/lib-prod/builder/column/value-column.js +29 -0
  15. package/lib-prod/builder/condition/query-column-condition.js +22 -0
  16. package/lib-prod/builder/condition/query-condition-chain.js +33 -0
  17. package/lib-prod/builder/condition/query-condition.js +6 -0
  18. package/lib-prod/builder/condition/query-join-condition.js +22 -0
  19. package/lib-prod/builder/helpers/generics-helper.js +5 -0
  20. package/lib-prod/builder/helpers/internal-types.js +0 -0
  21. package/lib-prod/builder/join/joined-tables-chain.js +14 -0
  22. package/lib-prod/builder/join/joined-tables.js +22 -0
  23. package/lib-prod/builder/other/query-ordering.js +20 -0
  24. package/lib-prod/builder/query/select-query.js +51 -0
  25. package/lib-prod/builder/query/table-condition-query.js +27 -0
  26. package/lib-prod/builder/query/table-query.js +54 -0
  27. package/lib-prod/builder/query-source.js +18 -0
  28. package/lib-prod/builder/query-table.js +27 -0
  29. package/lib-prod/client/mysql.js +10 -0
  30. package/lib-prod/client/pg.js +10 -0
  31. package/lib-prod/client/query-processor.js +44 -0
  32. package/lib-prod/converter/param-converter.js +23 -0
  33. package/lib-prod/converter/parameterized-converter.js +17 -0
  34. package/lib-prod/converter/query-converter.js +268 -0
  35. package/lib-prod/converter/result-converter.js +77 -0
  36. package/lib-prod/converter/sql-converter.js +8 -0
  37. package/lib-prod/converter/type-converter.js +32 -0
  38. package/lib-prod/converter/types.js +0 -0
  39. package/lib-prod/env/env.angular-node-app.js +130 -0
  40. package/lib-prod/env/env.docs-webapp.js +130 -0
  41. package/lib-prod/env/env.electron-app.js +130 -0
  42. package/lib-prod/env/env.mobile-app.js +130 -0
  43. package/lib-prod/env/env.npm-lib-and-cli-tool.js +130 -0
  44. package/lib-prod/env/env.vscode-plugin.js +130 -0
  45. package/lib-prod/env/index.js +6 -0
  46. package/lib-prod/index._auto-generated_.js +0 -0
  47. package/lib-prod/index.js +46 -0
  48. package/lib-prod/migrations/index.js +1 -0
  49. package/lib-prod/migrations/migrations_index._auto-generated_.js +0 -0
  50. package/lib-prod/package.json +1 -1
  51. package/package.json +1 -1
  52. package/websql/package.json +1 -1
  53. package/websql-prod/package.json +1 -1
  54. package/lib-prod/build-info._auto-generated_.ts +0 -27
  55. package/lib-prod/builder/column/basic-column.ts +0 -17
  56. package/lib-prod/builder/column/boolean-column.ts +0 -19
  57. package/lib-prod/builder/column/comparable-column.ts +0 -56
  58. package/lib-prod/builder/column/date-column.ts +0 -19
  59. package/lib-prod/builder/column/number-column.ts +0 -25
  60. package/lib-prod/builder/column/query-column.ts +0 -34
  61. package/lib-prod/builder/column/string-column.ts +0 -47
  62. package/lib-prod/builder/column/value-column.ts +0 -39
  63. package/lib-prod/builder/condition/query-column-condition.ts +0 -28
  64. package/lib-prod/builder/condition/query-condition-chain.ts +0 -42
  65. package/lib-prod/builder/condition/query-condition.ts +0 -13
  66. package/lib-prod/builder/condition/query-join-condition.ts +0 -27
  67. package/lib-prod/builder/helpers/generics-helper.ts +0 -2
  68. package/lib-prod/builder/helpers/internal-types.ts +0 -31
  69. package/lib-prod/builder/join/joined-tables-chain.ts +0 -17
  70. package/lib-prod/builder/join/joined-tables.ts +0 -28
  71. package/lib-prod/builder/other/query-ordering.ts +0 -26
  72. package/lib-prod/builder/query/select-query.ts +0 -68
  73. package/lib-prod/builder/query/table-condition-query.ts +0 -35
  74. package/lib-prod/builder/query/table-query.ts +0 -72
  75. package/lib-prod/builder/query-source.ts +0 -25
  76. package/lib-prod/builder/query-table.ts +0 -34
  77. package/lib-prod/client/mysql.ts +0 -9
  78. package/lib-prod/client/pg.ts +0 -9
  79. package/lib-prod/client/query-processor.ts +0 -89
  80. package/lib-prod/converter/param-converter.ts +0 -23
  81. package/lib-prod/converter/parameterized-converter.ts +0 -20
  82. package/lib-prod/converter/query-converter.ts +0 -296
  83. package/lib-prod/converter/result-converter.ts +0 -88
  84. package/lib-prod/converter/sql-converter.ts +0 -7
  85. package/lib-prod/converter/type-converter.ts +0 -29
  86. package/lib-prod/converter/types.ts +0 -6
  87. package/lib-prod/env/env.angular-node-app.ts +0 -66
  88. package/lib-prod/env/env.docs-webapp.ts +0 -66
  89. package/lib-prod/env/env.electron-app.ts +0 -66
  90. package/lib-prod/env/env.mobile-app.ts +0 -66
  91. package/lib-prod/env/env.npm-lib-and-cli-tool.ts +0 -66
  92. package/lib-prod/env/env.vscode-plugin.ts +0 -66
  93. package/lib-prod/env/index.ts +0 -6
  94. package/lib-prod/index._auto-generated_.ts +0 -5
  95. package/lib-prod/index.ts +0 -37
  96. package/lib-prod/lib-info.md +0 -8
  97. package/lib-prod/migrations/index.ts +0 -2
  98. package/lib-prod/migrations/migrations-info.md +0 -6
  99. package/lib-prod/migrations/migrations_index._auto-generated_.ts +0 -5
@@ -0,0 +1,46 @@
1
+ import { default as default2 } from "./builder/column/basic-column";
2
+ import { default as default3 } from "./builder/column/boolean-column";
3
+ import { default as default4 } from "./builder/column/comparable-column";
4
+ import { default as default5 } from "./builder/column/date-column";
5
+ import { default as default6 } from "./builder/column/number-column";
6
+ import { default as default7 } from "./builder/column/query-column";
7
+ import { default as default8 } from "./builder/column/string-column";
8
+ import { default as default9 } from "./builder/column/value-column";
9
+ import { default as default10 } from "./builder/condition/query-column-condition";
10
+ import { default as default11 } from "./builder/condition/query-condition";
11
+ import { default as default12 } from "./builder/condition/query-condition-chain";
12
+ import { default as default13 } from "./builder/condition/query-join-condition";
13
+ import { default as default14 } from "./builder/join/joined-tables";
14
+ import { default as default15 } from "./builder/join/joined-tables-chain";
15
+ import { default as default16 } from "./builder/other/query-ordering";
16
+ import { default as default17 } from "./builder/query/select-query";
17
+ import { default as default18 } from "./builder/query/table-query";
18
+ import { default as default19 } from "./builder/query/table-condition-query";
19
+ import { default as default20 } from "./builder/query-source";
20
+ import { default as default21 } from "./builder/query-table";
21
+ import { default as default22 } from "./client/mysql";
22
+ import { QueryProcessorOptions } from "./client/query-processor";
23
+ export {
24
+ default2 as BasicColumn,
25
+ default3 as BooleanColumn,
26
+ default4 as ComparableColumn,
27
+ default5 as DateColumn,
28
+ default14 as JoinedTables,
29
+ default15 as JoinedTablesChain,
30
+ default22 as MySqlQuerySource,
31
+ default6 as NumberColumn,
32
+ default7 as QueryColumn,
33
+ default10 as QueryColumnCondition,
34
+ default11 as QueryCondition,
35
+ default12 as QueryConditionChain,
36
+ default13 as QueryJoinCondition,
37
+ default16 as QueryOrdering,
38
+ QueryProcessorOptions,
39
+ default20 as QuerySource,
40
+ default21 as QueryTable,
41
+ default17 as SelectQuery,
42
+ default8 as StringColumn,
43
+ default19 as TableConditionQuery,
44
+ default18 as TableQuery,
45
+ default9 as ValueColumn
46
+ };
@@ -0,0 +1 @@
1
+ export * from "./migrations_index._auto-generated_";
@@ -1,4 +1,4 @@
1
1
  {
2
2
  "name": "taon-type-sql/lib-prod",
3
- "version": "21.0.22"
3
+ "version": "21.0.23"
4
4
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taon-type-sql",
3
- "version": "21.0.22",
3
+ "version": "21.0.23",
4
4
  "scripts": {
5
5
  "taon init": "taon init",
6
6
  "taon start": "taon start",
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taon-type-sql/websql",
3
- "version": "21.0.22",
3
+ "version": "21.0.23",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.0.0",
6
6
  "@angular/core": "^21.0.0"
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "taon-type-sql/websql-prod",
3
- "version": "21.0.22",
3
+ "version": "21.0.23",
4
4
  "peerDependencies": {
5
5
  "@angular/common": "^21.0.0",
6
6
  "@angular/core": "^21.0.0"
@@ -1,27 +0,0 @@
1
- // THIS FILE IS GENERATED - DO NOT MODIFY
2
- /**
3
- * Autogenerated by current cli tool
4
- */
5
- export const BUILD_FRAMEWORK_CLI_NAME = 'tnp';
6
- /**
7
- * This value can be change in taon.jsonc (appId)
8
- */
9
- export const APP_ID = 'com.domain.example.taon-type-sql';
10
- /**
11
- * Autogenerated by current cli tool
12
- */
13
- export const BUILD_BASE_HREF = '';
14
- /**
15
- * This value can be change in taon.jsonc (overrideNpmName)
16
- */
17
- export const PROJECT_NPM_NAME = 'taon-type-sql';
18
- /**
19
- * Taon version from you project taon.json
20
- */
21
- export const CURRENT_PACKAGE_TAON_VERSION = 'v21';
22
- /**
23
- * Autogenerated by current cli tool. Use *tnp release* to bump version.
24
- */
25
- export const CURRENT_PACKAGE_VERSION = '21.0.22';
26
- // THIS FILE IS GENERATED - DO NOT MODIFY
27
-
@@ -1,17 +0,0 @@
1
- import QueryTable from "../query-table";
2
- import QueryColumn from "./query-column";
3
- import NumberColumn from "./number-column";
4
- import {ColumnModifier, ColumnName} from "../helpers/internal-types";
5
-
6
- // This file is only needed because the QueryColumn can't implement its count method b. of circular dependencies
7
-
8
- export default class BasicColumn<Table extends QueryTable<any, any>, T> extends QueryColumn<Table, T> {
9
-
10
- constructor(table: Table, name: ColumnName, modifiers: ColumnModifier[] = []) {
11
- super(table, name, modifiers);
12
- }
13
-
14
- count(): NumberColumn<Table> {
15
- return new NumberColumn(this._table, this._name, this._modifiers.concat({ name: 'count' }));
16
- }
17
- }
@@ -1,19 +0,0 @@
1
- import QueryTable from "../query-table";
2
- import NumberColumn from "./number-column";
3
- import ValueColumn from "./value-column";
4
- import {ColumnModifier, ColumnName} from "../helpers/internal-types";
5
-
6
-
7
- export default class BooleanColumn<Table extends QueryTable<any, any>> extends ValueColumn<Table, boolean> {
8
-
9
- protected _type = 'boolean';
10
-
11
- constructor(table: Table, name: ColumnName, modifiers: ColumnModifier[] = []) {
12
- super(table, name, modifiers);
13
- }
14
-
15
- count(): NumberColumn<Table> {
16
- return new NumberColumn(this._table, this._name, this._modifiers.concat({ name: 'count' }));
17
- }
18
-
19
- }
@@ -1,56 +0,0 @@
1
- import QueryColumnCondition from "../condition/query-column-condition";
2
- import QueryTable from "../query-table";
3
- import ValueColumn from "./value-column";
4
- import {ColumnModifier, ColumnName} from "../helpers/internal-types";
5
-
6
-
7
- abstract class ComparableColumn<Table extends QueryTable<any, any>, T> extends ValueColumn<Table, T> {
8
-
9
- constructor(table: Table, name: ColumnName, modifiers: ColumnModifier[] = []) {
10
- super(table, name, modifiers);
11
- }
12
-
13
- lt(value: T) {
14
- return new QueryColumnCondition<Table, T>(this, 'lt', value);
15
- }
16
-
17
- gt(value: T) {
18
- return new QueryColumnCondition<Table, T>(this, 'gt', value);
19
- }
20
-
21
- lte(value: T) {
22
- return new QueryColumnCondition<Table, T>(this, 'lte', value);
23
- }
24
-
25
- gte(value: T) {
26
- return new QueryColumnCondition<Table, T>(this, 'gte', value);
27
- }
28
-
29
- in(values: T[]) {
30
- return new QueryColumnCondition<Table, T>(this, 'in', ...values);
31
- }
32
-
33
- notIn(values: T[]) {
34
- return new QueryColumnCondition<Table, T>(this, 'not-in', ...values);
35
- }
36
-
37
- between(value1: T, value2: T) {
38
- return new QueryColumnCondition<Table, T>(this, 'between', value1, value2);
39
- }
40
-
41
- notBetween(value1: T, value2: T) {
42
- return new QueryColumnCondition<Table, T>(this, 'not-between', value1, value2);
43
- }
44
-
45
- // min/max exists for text columns too, not just numeric and date
46
-
47
- min(): this {
48
- return new (<any>this.constructor)(this._table, this._name, this._modifiers.concat({ name: 'min' }));
49
- }
50
-
51
- max(): this {
52
- return new (<any>this.constructor)(this._table, this._name, this._modifiers.concat({ name: 'max' }));
53
- }
54
- }
55
-
56
- export default ComparableColumn;
@@ -1,19 +0,0 @@
1
- import QueryTable from "../query-table";
2
- import ComparableColumn from "./comparable-column";
3
- import NumberColumn from "./number-column";
4
- import {ColumnModifier, ColumnName} from "../helpers/internal-types";
5
-
6
-
7
- export default class DateColumn<Table extends QueryTable<any, any>> extends ComparableColumn<Table, Date> {
8
-
9
- protected _type = 'date';
10
-
11
- constructor(table: Table, name: ColumnName, modifiers: ColumnModifier[] = []) {
12
- super(table, name, modifiers);
13
- }
14
-
15
- count(): NumberColumn<Table> {
16
- return new NumberColumn(this._table, this._name, this._modifiers.concat({ name: 'count' }));
17
- }
18
-
19
- }
@@ -1,25 +0,0 @@
1
- import QueryTable from "../query-table";
2
- import ComparableColumn from "./comparable-column";
3
- import {ColumnModifier, ColumnName} from "../helpers/internal-types";
4
-
5
-
6
- export default class NumberColumn<Table extends QueryTable<any, any>> extends ComparableColumn<Table, number> {
7
-
8
- protected _type = 'number';
9
-
10
- constructor(table: Table, name: ColumnName, modifiers: ColumnModifier[] = []) {
11
- super(table, name, modifiers);
12
- }
13
-
14
- count(): NumberColumn<Table> {
15
- return new NumberColumn(this._table, this._name, this._modifiers.concat({ name: 'count' }));
16
- }
17
-
18
- sum(): NumberColumn<Table> {
19
- return new NumberColumn<Table>(this._table, this._name, this._modifiers.concat({ name: 'sum' }));
20
- }
21
-
22
- avg(): NumberColumn<Table> {
23
- return new NumberColumn<Table>(this._table, this._name, this._modifiers.concat({ name: 'avg' }));
24
- }
25
- }
@@ -1,34 +0,0 @@
1
- import QueryTable from "../query-table";
2
- import NumberColumn from "./number-column";
3
- import GenericsHelper from "../helpers/generics-helper";
4
- import QueryColumnCondition from "../condition/query-column-condition";
5
- import {ColumnModifier, ColumnName} from "../helpers/internal-types";
6
-
7
-
8
- abstract class QueryColumn<Table extends QueryTable<any, any>, T> {
9
-
10
- protected _$type: GenericsHelper<T>;
11
- protected _type: string;
12
-
13
- constructor(
14
- protected _table: Table,
15
- protected _name: ColumnName,
16
- protected _modifiers: ColumnModifier[] = []
17
- ) {}
18
-
19
- abstract count(): NumberColumn<Table>; // TODO I had to copy-paste the implementation to every child class to avoid a circular dependency
20
-
21
- as(alias: string): this {
22
- return new (<any>this.constructor)(this._table, this._name, this._modifiers.concat({ name: 'as', params: alias }));
23
- }
24
-
25
- isNull() {
26
- return new QueryColumnCondition<Table, T>(this, 'is-null');
27
- }
28
-
29
- isNotNull() {
30
- return new QueryColumnCondition<Table, T>(this, 'is-not-null');
31
- }
32
- }
33
-
34
- export default QueryColumn;
@@ -1,47 +0,0 @@
1
- import QueryTable from "../query-table";
2
- import ComparableColumn from "./comparable-column";
3
- import NumberColumn from "./number-column";
4
- import QueryColumnCondition from "../condition/query-column-condition";
5
- import {ColumnModifier, ColumnName} from "../helpers/internal-types";
6
-
7
-
8
- export default class StringColumn<Table extends QueryTable<any, any>> extends ComparableColumn<Table, string> {
9
-
10
- protected _type = 'string';
11
-
12
- constructor(table: Table, name: ColumnName, modifiers: ColumnModifier[] = []) {
13
- super(table, name, modifiers);
14
- }
15
-
16
- count(): NumberColumn<Table> {
17
- return new NumberColumn(this._table, this._name, this._modifiers.concat({ name: 'count' }));
18
- }
19
-
20
- lower(): this {
21
- return new (<any>this.constructor)(this._table, this._name, this._modifiers.concat({ name: 'lower' }));
22
- }
23
-
24
- upper(): this {
25
- return new (<any>this.constructor)(this._table, this._name, this._modifiers.concat({ name: 'upper' }));
26
- }
27
-
28
- contains(value: string) {
29
- return this.like('%' + value + '%');
30
- }
31
-
32
- startsWith(value: string) {
33
- return this.like(value + '%');
34
- }
35
-
36
- endsWith(value: string) {
37
- return this.like('%' + value);
38
- }
39
-
40
- like(value: string) {
41
- return new QueryColumnCondition<Table, string>(this, 'like', value);
42
- }
43
-
44
- notLike(value: string) {
45
- return new QueryColumnCondition<Table, string>(this, 'not-like', value);
46
- }
47
- }
@@ -1,39 +0,0 @@
1
- import QueryColumnCondition from "../condition/query-column-condition";
2
- import QueryOrdering from "../other/query-ordering";
3
- import QueryTable from "../query-table";
4
- import QueryColumn from "./query-column";
5
- import QueryCondition from "../condition/query-condition";
6
- import QueryJoinCondition from "../condition/query-join-condition";
7
- import {ColumnModifier, ColumnName} from "../helpers/internal-types";
8
-
9
-
10
- abstract class ValueColumn<Table extends QueryTable<any, any>, T> extends QueryColumn<Table, T> {
11
-
12
- constructor(table: Table, name: ColumnName, modifiers: ColumnModifier[] = []) {
13
- super(table, name, modifiers);
14
- }
15
-
16
- asc() {
17
- return new QueryOrdering<Table>(this, 'ASC');
18
- }
19
-
20
- desc() {
21
- return new QueryOrdering<Table>(this, 'DESC');
22
- }
23
-
24
- eq<Table2 extends QueryTable<any, any>>(value: QueryColumn<Table2, T>): QueryJoinCondition<Table, Table2, T>;
25
- eq(value: T): QueryColumnCondition<Table, T>;
26
- eq<Table2 extends QueryTable<any, any>>(value: any): QueryCondition<any> {
27
- if (value instanceof QueryColumn) {
28
- return new QueryJoinCondition<Table, Table2, T>(this, 'eq', value);
29
- } else {
30
- return new QueryColumnCondition<Table, T>(this, 'eq', value);
31
- }
32
- }
33
-
34
- ne(value: T) {
35
- return new QueryColumnCondition<Table, T>(this, 'ne', value);
36
- }
37
- }
38
-
39
- export default ValueColumn;
@@ -1,28 +0,0 @@
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
- import {ConditionType} from "../helpers/internal-types";
6
-
7
-
8
- export default class QueryColumnCondition<Table extends QueryTable<any, any>, T> extends QueryCondition<Table> {
9
-
10
- protected _column: QueryColumn<Table, T>;
11
- protected _type: ConditionType;
12
- protected _values: T[];
13
-
14
- constructor(column: QueryColumn<Table, T>, type: ConditionType, ...values: T[]) {
15
- super();
16
- this._column = column;
17
- this._type = type;
18
- this._values = values;
19
- }
20
-
21
- and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2> {
22
- return new QueryConditionChain<Table | Table2>(this, condition, 'and');
23
- }
24
-
25
- or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2> {
26
- return new QueryConditionChain<Table | Table2>(this, condition, 'or');
27
- }
28
- }
@@ -1,42 +0,0 @@
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
-
6
-
7
- export default class QueryConditionChain<Table extends QueryTable<any, any>> extends QueryCondition<Table> {
8
-
9
- protected _$type: GenericsHelper<Table>;
10
-
11
- protected _sibling: QueryCondition<any>;
12
- protected _child: QueryCondition<any>;
13
- protected _chainType: ConditionChainType;
14
- protected _parenthesis = false;
15
- protected _negation = false;
16
-
17
- constructor(sibling: QueryCondition<any>, child: QueryCondition<any>, chainType: ConditionChainType) {
18
- super();
19
- this._sibling = sibling;
20
- this._child = child;
21
- this._chainType = chainType;
22
- }
23
-
24
- // TODO how to call this
25
- $() {
26
- this._parenthesis = true;
27
- return this;
28
- }
29
-
30
- not() {
31
- this._negation = true;
32
- return this;
33
- }
34
-
35
- and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2> {
36
- return new QueryConditionChain<Table | Table2>(this, condition, 'and');
37
- }
38
-
39
- or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2> {
40
- return new QueryConditionChain<Table | Table2>(this, condition, 'or');
41
- }
42
- }
@@ -1,13 +0,0 @@
1
- import QueryTable from "../query-table";
2
- import QueryConditionChain from "./query-condition-chain";
3
-
4
- // TODO I had to copy-paste the method implementations to every child class to avoid circular dependencies
5
-
6
- abstract class QueryCondition<Table extends QueryTable<any, any>> {
7
-
8
- abstract and<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
9
-
10
- abstract or<Table2 extends QueryTable<any, any>>(condition: QueryCondition<Table2>): QueryConditionChain<Table | Table2>;
11
- }
12
-
13
- export default QueryCondition;
@@ -1,27 +0,0 @@
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
-
6
-
7
- export default class QueryJoinCondition<Table1 extends QueryTable<any, any>, Table2 extends QueryTable<any, any>, T> extends QueryCondition<Table1 | Table2> {
8
-
9
- protected _column: QueryColumn<Table1, T>;
10
- protected _type: string;
11
- protected _otherColumn: QueryColumn<Table2, T>;
12
-
13
- constructor(column: QueryColumn<Table1, T>, type: string, otherColumn: QueryColumn<Table2, T>) {
14
- super();
15
- this._column = column;
16
- this._type = type;
17
- this._otherColumn = otherColumn;
18
- }
19
-
20
- and<Table3 extends QueryTable<any, any>>(condition: QueryCondition<Table3>): QueryConditionChain<Table1 | Table2 | Table3> {
21
- return new QueryConditionChain<Table1 | Table2 | Table3>(this, condition, 'and');
22
- }
23
-
24
- or<Table3 extends QueryTable<any, any>>(condition: QueryCondition<Table3>): QueryConditionChain<Table1 | Table2 | Table3> {
25
- return new QueryConditionChain<Table1 | Table2 | Table3>(this, condition, 'or');
26
- }
27
- }
@@ -1,2 +0,0 @@
1
- // 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
2
- export default class GenericsHelper<T> {}
@@ -1,31 +0,0 @@
1
- // query:
2
-
3
- export type QueryAction = 'select' | 'insert' | 'update' | 'delete';
4
-
5
- // columns:
6
-
7
- export type ColumnModifierType = 'as' | 'count' | 'min' | 'min' | 'max' | 'sum' | 'avg' | 'lower' | 'upper';
8
-
9
- export interface ColumnModifier {
10
- name: ColumnModifierType,
11
- params?: any
12
- }
13
-
14
- export type ColumnName = string | { name: string, alias: string };
15
-
16
- export type ColumnType = 'boolean' | 'number' | 'string' | 'date'; // FIXME use this in the columns, but it causes type errors
17
-
18
- // conditions:
19
-
20
- export type ConditionChainType = 'or' | 'and';
21
-
22
- export type ConditionType = 'eq' | 'ne' | 'lt' | 'lte' | 'gt' | 'gte' | 'in' | 'not-in' | 'between' | 'not-between'
23
- | 'like' | 'not-like' | 'is-null' | 'is-not-null';
24
-
25
- // joins:
26
-
27
- export type JoinType = 'inner' | 'left' | 'right' | 'full';
28
-
29
- // processor:
30
-
31
- export type QueryProcessor = (query: any) => Promise<any>;
@@ -1,17 +0,0 @@
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
-
6
- export default class JoinedTablesChain<Tables extends QueryTable<any, any>> {
7
-
8
- constructor(
9
- protected _table: QueryTable<any, any>,
10
- protected _modifier: JoinType,
11
- protected _parent: JoinedTables<Tables> | QueryTable<any, any>
12
- ) {}
13
-
14
- on(condition: QueryJoinCondition<Tables, Tables, any>): JoinedTables<Tables> {
15
- return new JoinedTables(condition, this);
16
- }
17
- }
@@ -1,28 +0,0 @@
1
- import QueryTable from "../query-table";
2
- import JoinedTablesChain from "./joined-tables-chain";
3
- import QueryJoinCondition from "../condition/query-join-condition";
4
-
5
-
6
- export default class JoinedTables<Tables extends QueryTable<any, any>> {
7
-
8
- constructor(
9
- protected _condition: QueryJoinCondition<Tables, Tables, any>,
10
- protected _parent: JoinedTablesChain<Tables>
11
- ) {}
12
-
13
- innerJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable> {
14
- return new JoinedTablesChain(table, 'inner', this);
15
- }
16
-
17
- leftJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable> {
18
- return new JoinedTablesChain(table, 'left', this);
19
- }
20
-
21
- rightJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable> {
22
- return new JoinedTablesChain(table, 'right', this);
23
- }
24
-
25
- fullJoin<JoinTable extends QueryTable<any, any>>(table: JoinTable): JoinedTablesChain<Tables | JoinTable> {
26
- return new JoinedTablesChain(table, 'full', this);
27
- }
28
- }
@@ -1,26 +0,0 @@
1
- import QueryColumn from "../column/query-column";
2
- import QueryTable from "../query-table";
3
-
4
-
5
- export default class QueryOrdering<Table extends QueryTable<any, any>> {
6
-
7
- protected _column: QueryColumn<Table, any>;
8
- protected _direction: 'ASC' | 'DESC';
9
- protected _nullsPosition: 'FIRST' | 'LAST';
10
-
11
- constructor(column: QueryColumn<Table, any>, direction: 'ASC' | 'DESC') {
12
- this._column = column;
13
- this._direction = direction;
14
- }
15
-
16
- nullsFirst(): this {
17
- this._nullsPosition = 'FIRST';
18
- return this;
19
- }
20
-
21
- nullsLast(): this {
22
- this._nullsPosition = 'LAST';
23
- return this;
24
- }
25
-
26
- }