fib-orm 1.4.1 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/License +1 -1
- package/README.md +53 -0
- package/lib/cli/commands/ddlFrom.d.ts +2 -0
- package/lib/cli/commands/ddlFrom.js +74 -0
- package/lib/cli/commands/dumpModel.d.ts +2 -0
- package/lib/cli/commands/dumpModel.js +106 -0
- package/lib/cli/commands/escape.d.ts +2 -0
- package/lib/cli/commands/escape.js +68 -0
- package/lib/cli/commands/spinner.d.ts +2 -0
- package/lib/cli/commands/spinner.js +36 -0
- package/lib/cli/commands/upgrade.d.ts +2 -0
- package/lib/cli/commands/upgrade.js +65 -0
- package/lib/cli/helpers/ddl.d.ts +17 -0
- package/lib/cli/helpers/ddl.js +55 -0
- package/lib/cli/helpers/package.d.ts +26 -0
- package/lib/cli/helpers/package.js +56 -0
- package/lib/cli/index.d.ts +2 -0
- package/lib/cli/index.js +18 -0
- package/lib/codepoints-map.json +762 -0
- package/lib/db-driver/Typo.d.ts +112 -0
- package/lib/db-driver/Typo.js +1 -0
- package/lib/db-driver/built-ins/base.class.d.ts +96 -0
- package/lib/db-driver/built-ins/base.class.js +186 -0
- package/lib/db-driver/built-ins/driver-dm.d.ts +18 -0
- package/lib/db-driver/built-ins/driver-dm.js +53 -0
- package/lib/db-driver/built-ins/driver-mongodb.d.ts +24 -0
- package/lib/db-driver/built-ins/driver-mongodb.js +46 -0
- package/lib/db-driver/built-ins/driver-mysql.d.ts +18 -0
- package/lib/db-driver/built-ins/driver-mysql.js +37 -0
- package/lib/db-driver/built-ins/driver-postgresql.d.ts +22 -0
- package/lib/db-driver/built-ins/driver-postgresql.js +76 -0
- package/lib/db-driver/built-ins/driver-redis.d.ts +12 -0
- package/lib/db-driver/built-ins/driver-redis.js +35 -0
- package/lib/db-driver/built-ins/driver-sqlite.d.ts +17 -0
- package/lib/db-driver/built-ins/driver-sqlite.js +34 -0
- package/lib/db-driver/index.d.ts +3 -0
- package/lib/db-driver/index.js +4 -0
- package/lib/db-driver/utils.d.ts +14 -0
- package/lib/db-driver/utils.js +187 -0
- package/lib/knex/deps/tarn/dist/PendingOperation.d.ts +12 -0
- package/lib/knex/deps/tarn/dist/PendingOperation.js +48 -0
- package/lib/knex/deps/tarn/dist/Pool.d.ts +97 -0
- package/lib/knex/deps/tarn/dist/Pool.js +516 -0
- package/lib/knex/deps/tarn/dist/PromiseInspection.d.ts +16 -0
- package/lib/knex/deps/tarn/dist/PromiseInspection.js +21 -0
- package/lib/knex/deps/tarn/dist/Resource.d.ts +9 -0
- package/lib/knex/deps/tarn/dist/Resource.js +19 -0
- package/lib/knex/deps/tarn/dist/TimeoutError.d.ts +2 -0
- package/lib/knex/deps/tarn/dist/TimeoutError.js +5 -0
- package/lib/knex/deps/tarn/dist/tarn.d.ts +3 -0
- package/lib/knex/deps/tarn/dist/tarn.js +10 -0
- package/lib/knex/deps/tarn/dist/utils.d.ts +14 -0
- package/lib/knex/deps/tarn/dist/utils.js +60 -0
- package/lib/knex/knex.d.ts +2 -0
- package/lib/knex/knex.js +3 -0
- package/lib/knex/sandbox.d.ts +4 -0
- package/lib/knex/sandbox.js +22 -0
- package/lib/orm/Adapters.d.ts +3 -0
- package/lib/orm/Adapters.js +44 -0
- package/lib/orm/AggregateFunctions.d.ts +3 -0
- package/lib/orm/AggregateFunctions.js +176 -0
- package/lib/orm/Associations/Extend.d.ts +22 -0
- package/lib/orm/Associations/Extend.js +274 -0
- package/lib/orm/Associations/Many.d.ts +17 -0
- package/lib/orm/Associations/Many.js +569 -0
- package/lib/orm/Associations/One.d.ts +16 -0
- package/lib/orm/Associations/One.js +310 -0
- package/lib/orm/Associations/_utils.d.ts +15 -0
- package/lib/orm/Associations/_utils.js +52 -0
- package/lib/orm/ChainFind.d.ts +3 -0
- package/lib/orm/ChainFind.js +327 -0
- package/lib/orm/ChainInstance.d.ts +6 -0
- package/lib/orm/ChainInstance.js +73 -0
- package/lib/orm/Debug.d.ts +2 -0
- package/lib/orm/Debug.js +17 -0
- package/lib/orm/Drivers/DB/base.d.ts +3 -0
- package/lib/orm/Drivers/DB/base.js +3 -0
- package/lib/orm/Drivers/DB/dm.d.ts +11 -0
- package/lib/orm/Drivers/DB/dm.js +23 -0
- package/lib/orm/Drivers/DB/mysql.d.ts +11 -0
- package/lib/orm/Drivers/DB/mysql.js +23 -0
- package/lib/orm/Drivers/DB/postgres.d.ts +11 -0
- package/lib/orm/Drivers/DB/postgres.js +22 -0
- package/lib/orm/Drivers/DB/sqlite3.d.ts +16 -0
- package/lib/orm/Drivers/DB/sqlite3.js +39 -0
- package/lib/orm/Drivers/DML/_ddl-sql.d.ts +3 -0
- package/lib/orm/Drivers/DML/_ddl-sql.js +51 -0
- package/lib/orm/Drivers/DML/_dml-helpers.d.ts +19 -0
- package/lib/orm/Drivers/DML/_dml-helpers.js +51 -0
- package/lib/orm/Drivers/DML/_shared.d.ts +9 -0
- package/lib/orm/Drivers/DML/_shared.js +38 -0
- package/lib/orm/Drivers/DML/_utils.d.ts +8 -0
- package/lib/orm/Drivers/DML/_utils.js +67 -0
- package/lib/orm/Drivers/DML/constants.d.ts +3 -0
- package/lib/orm/Drivers/DML/constants.js +2 -0
- package/lib/orm/Drivers/DML/dm.d.ts +2 -0
- package/lib/orm/Drivers/DML/dm.js +293 -0
- package/lib/orm/Drivers/DML/index.d.ts +4 -0
- package/lib/orm/Drivers/DML/index.js +6 -0
- package/lib/orm/Drivers/DML/mysql.d.ts +2 -0
- package/lib/orm/Drivers/DML/mysql.js +251 -0
- package/lib/orm/Drivers/DML/postgres.d.ts +3 -0
- package/lib/orm/Drivers/DML/postgres.js +276 -0
- package/lib/orm/Drivers/DML/sqlite.d.ts +2 -0
- package/lib/orm/Drivers/DML/sqlite.js +266 -0
- package/lib/orm/Error.d.ts +11 -0
- package/lib/orm/Error.js +40 -0
- package/lib/orm/Helpers.d.ts +35 -0
- package/lib/orm/Helpers.js +233 -0
- package/lib/orm/Hook.d.ts +13 -0
- package/lib/orm/Hook.js +99 -0
- package/lib/orm/Instance.d.ts +2 -0
- package/lib/orm/Instance.js +697 -0
- package/lib/orm/LazyLoad.d.ts +4 -0
- package/lib/orm/LazyLoad.js +76 -0
- package/lib/orm/Model.d.ts +7 -0
- package/lib/orm/Model.js +971 -0
- package/lib/orm/ORM.d.ts +37 -0
- package/lib/orm/ORM.js +241 -0
- package/lib/orm/Patch/fib-cache.d.ts +40 -0
- package/lib/orm/Patch/fib-cache.js +2 -0
- package/lib/orm/Patch/plugin.d.ts +4 -0
- package/lib/orm/Patch/plugin.js +13 -0
- package/lib/orm/Property.d.ts +9 -0
- package/lib/orm/Property.js +71 -0
- package/lib/orm/Settings.d.ts +42 -0
- package/lib/orm/Settings.js +119 -0
- package/lib/orm/Singleton.d.ts +5 -0
- package/lib/orm/Singleton.js +72 -0
- package/lib/orm/Typo/Adapter.d.ts +5 -0
- package/lib/orm/Typo/Adapter.js +1 -0
- package/lib/orm/Typo/DMLDriver.d.ts +210 -0
- package/lib/orm/Typo/DMLDriver.js +1 -0
- package/lib/orm/Typo/Db.d.ts +38 -0
- package/lib/orm/Typo/Db.js +1 -0
- package/lib/orm/Typo/Error.d.ts +31 -0
- package/lib/orm/Typo/Error.js +1 -0
- package/lib/orm/Typo/ORM.d.ts +233 -0
- package/lib/orm/Typo/ORM.js +3 -0
- package/lib/orm/Typo/Validators.d.ts +32 -0
- package/lib/orm/Typo/Validators.js +2 -0
- package/lib/orm/Typo/_common.d.ts +38 -0
- package/lib/orm/Typo/_common.js +1 -0
- package/lib/orm/Typo/assoc.d.ts +221 -0
- package/lib/orm/Typo/assoc.js +1 -0
- package/lib/orm/Typo/hook.d.ts +42 -0
- package/lib/orm/Typo/hook.js +1 -0
- package/lib/orm/Typo/instance.d.ts +157 -0
- package/lib/orm/Typo/instance.js +1 -0
- package/lib/orm/Typo/model.d.ts +313 -0
- package/lib/orm/Typo/model.js +6 -0
- package/lib/orm/Typo/patch.d.ts +31 -0
- package/lib/orm/Typo/patch.js +1 -0
- package/lib/orm/Typo/property.d.ts +57 -0
- package/lib/orm/Typo/property.js +1 -0
- package/lib/orm/Typo/query.d.ts +216 -0
- package/lib/orm/Typo/query.js +1 -0
- package/lib/orm/Typo/settings.d.ts +35 -0
- package/lib/orm/Typo/settings.js +5 -0
- package/lib/orm/Typo/synchronous.d.ts +47 -0
- package/lib/orm/Typo/synchronous.js +1 -0
- package/lib/orm/Utilities.d.ts +179 -0
- package/lib/orm/Utilities.js +975 -0
- package/lib/orm/Validators.d.ts +34 -0
- package/lib/orm/Validators.js +100 -0
- package/lib/orm/Where/common.d.ts +1 -0
- package/lib/orm/Where/common.js +7 -0
- package/lib/orm/Where/filterDate.d.ts +11 -0
- package/lib/orm/Where/filterDate.js +58 -0
- package/lib/orm/index.d.ts +68 -0
- package/lib/orm/index.js +157 -0
- package/lib/orm-core/callback.d.ts +12 -0
- package/lib/orm-core/callback.js +1 -0
- package/lib/orm-core/dialect.d.ts +80 -0
- package/lib/orm-core/dialect.js +1 -0
- package/lib/orm-core/error.d.ts +16 -0
- package/lib/orm-core/error.js +29 -0
- package/lib/orm-core/index.d.ts +6 -0
- package/lib/orm-core/index.js +6 -0
- package/lib/orm-core/sync.d.ts +12 -0
- package/lib/orm-core/sync.js +1 -0
- package/lib/orm-core/utils.d.ts +1 -0
- package/lib/orm-core/utils.js +5 -0
- package/lib/orm-property/Property.d.ts +78 -0
- package/lib/orm-property/Property.js +1 -0
- package/lib/orm-property/Utils.d.ts +9 -0
- package/lib/orm-property/Utils.js +13 -0
- package/lib/orm-property/customTypes.d.ts +2 -0
- package/lib/orm-property/customTypes.js +13 -0
- package/lib/orm-property/index.d.ts +10 -0
- package/lib/orm-property/index.js +22 -0
- package/lib/orm-property/transformer.d.ts +5 -0
- package/lib/orm-property/transformer.js +10 -0
- package/lib/orm-property/transformers/dm.d.ts +29 -0
- package/lib/orm-property/transformers/dm.js +237 -0
- package/lib/orm-property/transformers/index.d.ts +4 -0
- package/lib/orm-property/transformers/index.js +5 -0
- package/lib/orm-property/transformers/mysql.d.ts +102 -0
- package/lib/orm-property/transformers/mysql.js +261 -0
- package/lib/orm-property/transformers/postgresql.d.ts +54 -0
- package/lib/orm-property/transformers/postgresql.js +189 -0
- package/lib/orm-property/transformers/sqlite.d.ts +19 -0
- package/lib/orm-property/transformers/sqlite.js +171 -0
- package/lib/sql-ddl-sync/Dialects/dm.d.ts +40 -0
- package/lib/sql-ddl-sync/Dialects/dm.js +296 -0
- package/lib/sql-ddl-sync/Dialects/index.d.ts +7 -0
- package/lib/sql-ddl-sync/Dialects/index.js +7 -0
- package/lib/sql-ddl-sync/Dialects/mysql.d.ts +39 -0
- package/lib/sql-ddl-sync/Dialects/mysql.js +240 -0
- package/lib/sql-ddl-sync/Dialects/postgresql.d.ts +40 -0
- package/lib/sql-ddl-sync/Dialects/postgresql.js +286 -0
- package/lib/sql-ddl-sync/Dialects/sqlite.d.ts +44 -0
- package/lib/sql-ddl-sync/Dialects/sqlite.js +256 -0
- package/lib/sql-ddl-sync/SQL.d.ts +12 -0
- package/lib/sql-ddl-sync/SQL.js +108 -0
- package/lib/sql-ddl-sync/Typo/Collection.d.ts +13 -0
- package/lib/sql-ddl-sync/Typo/Collection.js +1 -0
- package/lib/sql-ddl-sync/Typo/DbIndex.d.ts +13 -0
- package/lib/sql-ddl-sync/Typo/DbIndex.js +1 -0
- package/lib/sql-ddl-sync/Typo/Dialect.d.ts +81 -0
- package/lib/sql-ddl-sync/Typo/Dialect.js +1 -0
- package/lib/sql-ddl-sync/Typo/Driver.d.ts +53 -0
- package/lib/sql-ddl-sync/Typo/Driver.js +1 -0
- package/lib/sql-ddl-sync/Typo/Query.d.ts +7 -0
- package/lib/sql-ddl-sync/Typo/Query.js +1 -0
- package/lib/sql-ddl-sync/Typo/SQL.d.ts +31 -0
- package/lib/sql-ddl-sync/Typo/SQL.js +1 -0
- package/lib/sql-ddl-sync/Typo/_common.d.ts +29 -0
- package/lib/sql-ddl-sync/Typo/_common.js +1 -0
- package/lib/sql-ddl-sync/Utils.d.ts +40 -0
- package/lib/sql-ddl-sync/Utils.js +217 -0
- package/lib/sql-ddl-sync/index.d.ts +87 -0
- package/lib/sql-ddl-sync/index.js +371 -0
- package/lib/sql-query/Comparators.d.ts +3 -0
- package/lib/sql-query/Comparators.js +94 -0
- package/lib/sql-query/Create.d.ts +35 -0
- package/lib/sql-query/Create.js +77 -0
- package/lib/sql-query/Dialects/dm.d.ts +3 -0
- package/lib/sql-query/Dialects/dm.js +74 -0
- package/lib/sql-query/Dialects/index.d.ts +10 -0
- package/lib/sql-query/Dialects/index.js +12 -0
- package/lib/sql-query/Dialects/mssql.d.ts +3 -0
- package/lib/sql-query/Dialects/mssql.js +73 -0
- package/lib/sql-query/Dialects/mysql.d.ts +3 -0
- package/lib/sql-query/Dialects/mysql.js +100 -0
- package/lib/sql-query/Dialects/postgresql.d.ts +3 -0
- package/lib/sql-query/Dialects/postgresql.js +76 -0
- package/lib/sql-query/Dialects/sqlite.d.ts +3 -0
- package/lib/sql-query/Dialects/sqlite.js +61 -0
- package/lib/sql-query/Helpers.d.ts +38 -0
- package/lib/sql-query/Helpers.js +259 -0
- package/lib/sql-query/Insert.d.ts +12 -0
- package/lib/sql-query/Insert.js +33 -0
- package/lib/sql-query/Query.d.ts +29 -0
- package/lib/sql-query/Query.js +119 -0
- package/lib/sql-query/Remove.d.ts +16 -0
- package/lib/sql-query/Remove.js +93 -0
- package/lib/sql-query/Select.d.ts +62 -0
- package/lib/sql-query/Select.js +533 -0
- package/lib/sql-query/Set.d.ts +4 -0
- package/lib/sql-query/Set.js +16 -0
- package/lib/sql-query/Typo/Aggregation.d.ts +32 -0
- package/lib/sql-query/Typo/Aggregation.js +1 -0
- package/lib/sql-query/Typo/Comparators.d.ts +140 -0
- package/lib/sql-query/Typo/Comparators.js +1 -0
- package/lib/sql-query/Typo/Dialect.d.ts +39 -0
- package/lib/sql-query/Typo/Dialect.js +1 -0
- package/lib/sql-query/Typo/Field.d.ts +8 -0
- package/lib/sql-query/Typo/Field.js +1 -0
- package/lib/sql-query/Typo/Helper.d.ts +4 -0
- package/lib/sql-query/Typo/Helper.js +1 -0
- package/lib/sql-query/Typo/Query-ChainBuilder.d.ts +80 -0
- package/lib/sql-query/Typo/Query-ChainBuilder.js +1 -0
- package/lib/sql-query/Typo/Query.d.ts +34 -0
- package/lib/sql-query/Typo/Query.js +16 -0
- package/lib/sql-query/Typo/Sql.d.ts +143 -0
- package/lib/sql-query/Typo/Sql.js +1 -0
- package/lib/sql-query/Typo/SubQuery.d.ts +39 -0
- package/lib/sql-query/Typo/SubQuery.js +1 -0
- package/lib/sql-query/Typo/index.d.ts +9 -0
- package/lib/sql-query/Typo/index.js +1 -0
- package/lib/sql-query/Update.d.ts +15 -0
- package/lib/sql-query/Update.js +38 -0
- package/lib/sql-query/Where.d.ts +4 -0
- package/lib/sql-query/Where.js +280 -0
- package/package.json +72 -36
- package/.travis.yml +0 -14
- package/@types/index.d.ts +0 -193
- package/@types/orm_mirror/orm.d.ts +0 -275
- package/@types/orm_mirror/sql-query.d.ts +0 -79
- package/Readme.md +0 -843
- package/lib/index.js +0 -13
- package/lib/modules/mysql.js +0 -35
- package/lib/modules/sqlite3.js +0 -27
- package/lib/patch.js +0 -271
|
@@ -0,0 +1,140 @@
|
|
|
1
|
+
export declare namespace FxSqlQueryComparator {
|
|
2
|
+
type IdType = string | number;
|
|
3
|
+
type SimpleEqValueType = string | number | boolean | Date;
|
|
4
|
+
type NormalizedInOperator = 'in' | 'not_in' | 'IN' | 'NOT_IN';
|
|
5
|
+
type InputValue_eq = {
|
|
6
|
+
"eq": SimpleEqValueType;
|
|
7
|
+
};
|
|
8
|
+
type InputValue_ne = {
|
|
9
|
+
"ne": SimpleEqValueType;
|
|
10
|
+
};
|
|
11
|
+
type InputValue_gt = {
|
|
12
|
+
"gt": number;
|
|
13
|
+
};
|
|
14
|
+
type InputValue_gte = {
|
|
15
|
+
"gte": number;
|
|
16
|
+
};
|
|
17
|
+
type InputValue_lt = {
|
|
18
|
+
"lt": number;
|
|
19
|
+
};
|
|
20
|
+
type InputValue_lte = {
|
|
21
|
+
"lte": number;
|
|
22
|
+
};
|
|
23
|
+
type InputValue_like = {
|
|
24
|
+
"like": string;
|
|
25
|
+
};
|
|
26
|
+
type InputValue_not_like = {
|
|
27
|
+
"not_like": string;
|
|
28
|
+
};
|
|
29
|
+
type InputValue_between = {
|
|
30
|
+
"between": [number, number];
|
|
31
|
+
};
|
|
32
|
+
type InputValue_not_between = {
|
|
33
|
+
"not_between": [number, number];
|
|
34
|
+
};
|
|
35
|
+
type InputValue_in = {
|
|
36
|
+
"in": IdType[];
|
|
37
|
+
};
|
|
38
|
+
type InputValue_not_in = {
|
|
39
|
+
"not_in": IdType[];
|
|
40
|
+
};
|
|
41
|
+
type InputComparatorObjectValue = InputValue_eq | InputValue_ne | InputValue_gt | InputValue_gte | InputValue_lt | InputValue_lte | InputValue_like | InputValue_not_like | InputValue_between | InputValue_not_between | InputValue_in | InputValue_not_in;
|
|
42
|
+
type InputValueType = SimpleEqValueType | InputComparatorObjectValue;
|
|
43
|
+
interface SubQueryComparatorInput {
|
|
44
|
+
[k: string]: FxSqlQueryComparator.QueryComparatorObject;
|
|
45
|
+
}
|
|
46
|
+
interface SubQuerySimpleEqInput {
|
|
47
|
+
[k: string]: SimpleEqValueType;
|
|
48
|
+
}
|
|
49
|
+
interface SubQueryInput {
|
|
50
|
+
[k: string]: FxSqlQueryComparator.QueryComparatorObject | SimpleEqValueType;
|
|
51
|
+
}
|
|
52
|
+
interface Input {
|
|
53
|
+
[key: string]: InputValueType;
|
|
54
|
+
}
|
|
55
|
+
type QueryComparatorExprType = string;
|
|
56
|
+
type QueryComparatorObject<T = any> = {
|
|
57
|
+
sql_comparator(): ComparatorNames;
|
|
58
|
+
val?: T;
|
|
59
|
+
asIdentifier?: boolean;
|
|
60
|
+
expr?: QueryComparatorExprType;
|
|
61
|
+
from?: string;
|
|
62
|
+
to?: string;
|
|
63
|
+
};
|
|
64
|
+
type SimpleQueryConjunctionWord_NonNegetive = "or" | "and";
|
|
65
|
+
type SimpleQueryConjunctionWord = SimpleQueryConjunctionWord_NonNegetive | "not";
|
|
66
|
+
type QueryConjunctionWord = SimpleQueryConjunctionWord | "not_or" | "not_and";
|
|
67
|
+
interface QueryComparatorLiteralObject {
|
|
68
|
+
between: any | any[];
|
|
69
|
+
not_between: any | any[];
|
|
70
|
+
like: any | any[];
|
|
71
|
+
not_like: any | any[];
|
|
72
|
+
eq: any | any[];
|
|
73
|
+
ne: any | any[];
|
|
74
|
+
gt: any | any[];
|
|
75
|
+
gte: any | any[];
|
|
76
|
+
lt: any | any[];
|
|
77
|
+
lte: any | any[];
|
|
78
|
+
in: any | any[];
|
|
79
|
+
not_in: any | any[];
|
|
80
|
+
modifiers?: {
|
|
81
|
+
is_date?: boolean;
|
|
82
|
+
[modifier_name: string]: any;
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
type ComparatorHash = {
|
|
86
|
+
between: FxSqlQueryComparatorFunction.between;
|
|
87
|
+
not_between: FxSqlQueryComparatorFunction.not_between;
|
|
88
|
+
like: FxSqlQueryComparatorFunction.like;
|
|
89
|
+
not_like: FxSqlQueryComparatorFunction.not_like;
|
|
90
|
+
eq: FxSqlQueryComparatorFunction.eq;
|
|
91
|
+
ne: FxSqlQueryComparatorFunction.ne;
|
|
92
|
+
gt: FxSqlQueryComparatorFunction.gt;
|
|
93
|
+
gte: FxSqlQueryComparatorFunction.gte;
|
|
94
|
+
lt: FxSqlQueryComparatorFunction.lt;
|
|
95
|
+
lte: FxSqlQueryComparatorFunction.lte;
|
|
96
|
+
in: FxSqlQueryComparatorFunction.not_in;
|
|
97
|
+
not_in: FxSqlQueryComparatorFunction.not_in;
|
|
98
|
+
};
|
|
99
|
+
type ComparatorNameType = keyof ComparatorHash;
|
|
100
|
+
type ComparatorNames = ComparatorNameType;
|
|
101
|
+
type QueryComparatorType = ComparatorNameType | 'sql';
|
|
102
|
+
}
|
|
103
|
+
export declare namespace FxSqlQueryComparatorFunction {
|
|
104
|
+
interface between {
|
|
105
|
+
(a: string, b: string, options?: __Options): FxSqlQueryComparator.QueryComparatorObject;
|
|
106
|
+
}
|
|
107
|
+
interface not_between {
|
|
108
|
+
(a: string, b: string, options?: __Options): FxSqlQueryComparator.QueryComparatorObject;
|
|
109
|
+
}
|
|
110
|
+
interface like {
|
|
111
|
+
(expr: FxSqlQueryComparator.QueryComparatorExprType, options?: __Options): FxSqlQueryComparator.QueryComparatorObject;
|
|
112
|
+
}
|
|
113
|
+
interface not_like {
|
|
114
|
+
(expr: FxSqlQueryComparator.QueryComparatorExprType, options?: __Options): FxSqlQueryComparator.QueryComparatorObject;
|
|
115
|
+
}
|
|
116
|
+
interface eq {
|
|
117
|
+
(v: any, options?: __Options): FxSqlQueryComparator.QueryComparatorObject;
|
|
118
|
+
}
|
|
119
|
+
interface ne {
|
|
120
|
+
(v: any, options?: __Options): FxSqlQueryComparator.QueryComparatorObject;
|
|
121
|
+
}
|
|
122
|
+
interface gt {
|
|
123
|
+
(v: any, options?: __Options): FxSqlQueryComparator.QueryComparatorObject;
|
|
124
|
+
}
|
|
125
|
+
interface gte {
|
|
126
|
+
(v: any, options?: __Options): FxSqlQueryComparator.QueryComparatorObject;
|
|
127
|
+
}
|
|
128
|
+
interface lt {
|
|
129
|
+
(v: any, options?: __Options): FxSqlQueryComparator.QueryComparatorObject;
|
|
130
|
+
}
|
|
131
|
+
interface lte {
|
|
132
|
+
(v: any, options?: __Options): FxSqlQueryComparator.QueryComparatorObject;
|
|
133
|
+
}
|
|
134
|
+
interface not_in {
|
|
135
|
+
(v: any, options?: __Options): FxSqlQueryComparator.QueryComparatorObject;
|
|
136
|
+
}
|
|
137
|
+
type __Options = {
|
|
138
|
+
asIdentifier?: boolean;
|
|
139
|
+
};
|
|
140
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FxSqlQuery } from "./Query";
|
|
2
|
+
import { FxSqlQuerySql } from "./Sql";
|
|
3
|
+
export declare namespace FxSqlQueryDialect {
|
|
4
|
+
type DialectType = 'mysql' | 'mssql' | 'sqlite' | 'postgresql' | 'dm';
|
|
5
|
+
interface DataTypesDescriptorBase {
|
|
6
|
+
id: string;
|
|
7
|
+
int: string;
|
|
8
|
+
float: string;
|
|
9
|
+
bool: string;
|
|
10
|
+
text: string;
|
|
11
|
+
}
|
|
12
|
+
type DialectFieldType = keyof DataTypesDescriptorBase;
|
|
13
|
+
interface DataTypesDescriptor extends DataTypesDescriptorBase {
|
|
14
|
+
isSQLITE?: boolean;
|
|
15
|
+
}
|
|
16
|
+
interface Dialect<T extends DialectType = DialectType> {
|
|
17
|
+
DataTypes: DataTypesDescriptor;
|
|
18
|
+
type: T;
|
|
19
|
+
escape: {
|
|
20
|
+
(query: FxSqlQuerySql.SqlFragmentStr, args: FxSqlQuerySql.SqlAssignmentValues): string;
|
|
21
|
+
};
|
|
22
|
+
escapeId: {
|
|
23
|
+
(...els: (FxSqlQuerySql.SqlEscapeArgIdType | {
|
|
24
|
+
str: string;
|
|
25
|
+
escapes: string[];
|
|
26
|
+
})[]): string;
|
|
27
|
+
};
|
|
28
|
+
escapeVal: {
|
|
29
|
+
(val: FxSqlQuerySql.SqlEscapeArgType, timezone?: FxSqlQuery.FxSqlQueryTimezone): string;
|
|
30
|
+
(vals: FxSqlQuerySql.DetailedQueryWhereCondition__InStyle['val'], timezone?: FxSqlQuery.FxSqlQueryTimezone): string;
|
|
31
|
+
};
|
|
32
|
+
limitAsTop: boolean;
|
|
33
|
+
readonly knex: import('../../knex/types').Knex;
|
|
34
|
+
defaultValuesStmt?: T extends 'postgresql' ? string : never;
|
|
35
|
+
}
|
|
36
|
+
type fn_escape = Dialect['escape'];
|
|
37
|
+
type fn_escapeId = Dialect['escapeId'];
|
|
38
|
+
type fn_escapeVal = Dialect['escapeVal'];
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { FxSqlQueryDialect } from './Dialect';
|
|
2
|
+
import { FxSqlQuerySql } from './Sql';
|
|
3
|
+
export declare namespace FxSqlQueryColumns {
|
|
4
|
+
type SelectInputArgType = string | FxSqlQuerySql.SqlSelectFieldItemDescriptor;
|
|
5
|
+
interface FieldItemTypeMap {
|
|
6
|
+
[key: string]: FxSqlQueryDialect.DialectFieldType;
|
|
7
|
+
}
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,80 @@
|
|
|
1
|
+
import { FxSqlQuery } from "./Query";
|
|
2
|
+
import { FxSqlQuerySql } from "./Sql";
|
|
3
|
+
import { FxSqlAggregation } from "./Aggregation";
|
|
4
|
+
import { FxSqlQueryDialect } from "./Dialect";
|
|
5
|
+
import { FxSqlQueryColumns } from "./Field";
|
|
6
|
+
import { FxSqlQuerySubQuery } from "./SubQuery";
|
|
7
|
+
import { FxSqlQueryHelpler } from "./Helper";
|
|
8
|
+
export declare namespace FxSqlQueryChainBuilder {
|
|
9
|
+
type QueryWhereConditionPayloadUnit = FxSqlQuerySql.DetailedQueryWhereCondition | string | null;
|
|
10
|
+
interface ChainBuilderOptions extends FxSqlQuery.QueryOptions {
|
|
11
|
+
}
|
|
12
|
+
interface ChainBuilder {
|
|
13
|
+
readonly knex: FxSqlQuery.Class_Query['knex'];
|
|
14
|
+
build(): string;
|
|
15
|
+
}
|
|
16
|
+
interface ChainBuilderPaginationMixin {
|
|
17
|
+
offset(offset: number): this;
|
|
18
|
+
limit(limit: number | string): this;
|
|
19
|
+
}
|
|
20
|
+
interface ChainBuilderSortMixin {
|
|
21
|
+
/**
|
|
22
|
+
*
|
|
23
|
+
* @param column
|
|
24
|
+
* @param dir
|
|
25
|
+
*
|
|
26
|
+
* @sample
|
|
27
|
+
* .order('col1', 'Z')
|
|
28
|
+
* .order(['table1', 'col1'], 'A')
|
|
29
|
+
* .order('ID DESC')
|
|
30
|
+
* .order('?? DESC', ['ID'])
|
|
31
|
+
*/
|
|
32
|
+
order(column: FxSqlQuery.OrderNormalizedResult[0], dir?: FxSqlQuery.OrderNormalizedResult[1]): this;
|
|
33
|
+
}
|
|
34
|
+
type ChainBuilder__SelectAggregationFunColumnArg = (string | string[])[];
|
|
35
|
+
interface ChainBuilder__Select extends ChainBuilder, FxSqlAggregation.SupportedAggregationsMixin, ChainBuilderPaginationMixin, ChainBuilderSortMixin {
|
|
36
|
+
Dialect: FxSqlQueryDialect.Dialect;
|
|
37
|
+
select: (fields: FxSqlQueryColumns.SelectInputArgType[]) => this;
|
|
38
|
+
/**
|
|
39
|
+
* .where('table1', {t1_col1: 'v1'}, 'table2', {t1_col2: 'v2'}, ...)
|
|
40
|
+
* .where({__sql: 'xxx'})
|
|
41
|
+
* .where({col1: 'v1', col1: 'v1'})
|
|
42
|
+
* .where(not: [ { col: 2 }, { col: 3 } ])
|
|
43
|
+
*/
|
|
44
|
+
where: (...whereConditions: (FxSqlQuerySubQuery.SubQueryBuildDescriptor['wheres'] | FxSqlQuerySubQuery.WhereExistsTuple_Flatten[0])[]) => this;
|
|
45
|
+
whereExists: (table: string, table_link: string | FxSqlQuerySql.SqlFromTableInput, link: FxSqlQuerySql.WhereExistsLinkTuple, cond: FxSqlQuerySubQuery.SubQueryBuildDescriptor['wheres']) => this;
|
|
46
|
+
groupBy: (...args: FxSqlQuerySql.SqlGroupByType[]) => this;
|
|
47
|
+
fun: (fun: string, column?: FxSqlQuerySql.SqlColumnType, _as?: string) => this;
|
|
48
|
+
from: {
|
|
49
|
+
/**
|
|
50
|
+
* @warning can be only used in first call!
|
|
51
|
+
*/
|
|
52
|
+
(table: FxSqlQuerySql.SqlTableInputType): ChainBuilder__Select;
|
|
53
|
+
(table: FxSqlQuerySql.SqlTableInputType, from_id: FxSqlQueryHelpler.Arraiable<string>, to_id: FxSqlQueryHelpler.Arraiable<string>): ChainBuilder__Select;
|
|
54
|
+
(table: FxSqlQuerySql.SqlTableInputType, from_id: FxSqlQueryHelpler.Arraiable<string>, to_table: string, to_id: FxSqlQueryHelpler.Arraiable<string>, fromOpts?: FxSqlQuerySql.QueryFromDescriptorOpts): ChainBuilder__Select;
|
|
55
|
+
};
|
|
56
|
+
[extra: string]: any;
|
|
57
|
+
}
|
|
58
|
+
interface ChainBuilder__Insert extends ChainBuilder {
|
|
59
|
+
into(table: string): this | ChainBuilder__Insert;
|
|
60
|
+
set(values: FxSqlQuerySql.DataToSet): this | ChainBuilder__Insert;
|
|
61
|
+
}
|
|
62
|
+
interface ChainBuilder__Create extends ChainBuilder {
|
|
63
|
+
table(table: string): this | ChainBuilder__Create;
|
|
64
|
+
field(table: string, type: FxSqlQueryDialect.DialectFieldType): this | ChainBuilder__Create;
|
|
65
|
+
fields: {
|
|
66
|
+
(): FxSqlQueryColumns.FieldItemTypeMap;
|
|
67
|
+
(fields: FxSqlQueryColumns.FieldItemTypeMap): ChainBuilder__Create;
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
interface ChainBuilder__Update extends ChainBuilder {
|
|
71
|
+
where: (...whereConditions: FxSqlQuerySubQuery.SubQueryBuildDescriptor['wheres'][]) => ChainBuilder__Update;
|
|
72
|
+
into(table: string): this | ChainBuilder__Update;
|
|
73
|
+
set(values: FxSqlQuerySql.DataToSet): this | ChainBuilder__Update;
|
|
74
|
+
}
|
|
75
|
+
interface ChainBuilder__Remove extends ChainBuilder, ChainBuilderPaginationMixin {
|
|
76
|
+
order(column: string, dir: FxSqlQuery.QueryOrderDirection): this;
|
|
77
|
+
where: (...whereConditions: FxSqlQuerySubQuery.SubQueryBuildDescriptor['wheres'][]) => this;
|
|
78
|
+
from(table: string): this;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import { FxSqlQueryDialect } from "./Dialect";
|
|
2
|
+
import { FxSqlQueryChainBuilder } from "./Query-ChainBuilder";
|
|
3
|
+
import { FxSqlQuerySql } from './Sql';
|
|
4
|
+
export declare namespace FxSqlQuery {
|
|
5
|
+
type OrderNormalizedTuple = [string | string[], "Z" | "A"];
|
|
6
|
+
type OrderSqlStyleTuple = [FxSqlQuerySql.SqlFragmentStr, FxSqlQuerySql.SqlAssignmentValues?];
|
|
7
|
+
type OrderNormalizedResult = OrderNormalizedTuple | OrderSqlStyleTuple;
|
|
8
|
+
interface QueryOptions {
|
|
9
|
+
dialect?: FxSqlQueryDialect.DialectType;
|
|
10
|
+
timezone?: FxSqlQueryTimezone;
|
|
11
|
+
}
|
|
12
|
+
type QueryOrderDirection = 'Z' | 'A' | string;
|
|
13
|
+
type FxSqlQueryTimezone = 'Z' | 'local' | string;
|
|
14
|
+
interface TypedQueryObject<T = 'text' | string, TD = any> {
|
|
15
|
+
data: TD;
|
|
16
|
+
type(): T;
|
|
17
|
+
}
|
|
18
|
+
interface TypedQueryObjectWrapper<T = 'text' | string, TD = any> {
|
|
19
|
+
(data: TD): FxSqlQuery.TypedQueryObject<T, TD>;
|
|
20
|
+
}
|
|
21
|
+
class Class_Query {
|
|
22
|
+
constructor(_opts?: string | FxSqlQuery.QueryOptions);
|
|
23
|
+
readonly knex: FxSqlQueryDialect.Dialect['knex'];
|
|
24
|
+
readonly Dialect: FxSqlQueryDialect.Dialect;
|
|
25
|
+
escape: FxSqlQueryDialect.Dialect['escape'];
|
|
26
|
+
escapeId: FxSqlQueryDialect.Dialect['escapeId'];
|
|
27
|
+
escapeVal: FxSqlQueryDialect.Dialect['escapeVal'];
|
|
28
|
+
create(): FxSqlQueryChainBuilder.ChainBuilder__Create;
|
|
29
|
+
select(): FxSqlQueryChainBuilder.ChainBuilder__Select;
|
|
30
|
+
insert(): FxSqlQueryChainBuilder.ChainBuilder__Insert;
|
|
31
|
+
update(): FxSqlQueryChainBuilder.ChainBuilder__Update;
|
|
32
|
+
remove(): FxSqlQueryChainBuilder.ChainBuilder__Remove;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.FxSqlQuery = void 0;
|
|
3
|
+
var FxSqlQuery;
|
|
4
|
+
(function (FxSqlQuery) {
|
|
5
|
+
// interface ExportModule {
|
|
6
|
+
// comparators: FxSqlQueryComparator.ComparatorHash
|
|
7
|
+
// Text: FxSqlQuery.TypedQueryObjectWrapper<'text'>
|
|
8
|
+
// Helpers: FxSqlQueryHelpler.HelperModule
|
|
9
|
+
// Dialects: {
|
|
10
|
+
// mysql: FxSqlQueryDialect.Dialect
|
|
11
|
+
// sqlite: FxSqlQueryDialect.Dialect
|
|
12
|
+
// mssql: FxSqlQueryDialect.Dialect
|
|
13
|
+
// }
|
|
14
|
+
// Query: typeof FxSqlQuery.Class_Query
|
|
15
|
+
// }
|
|
16
|
+
})(FxSqlQuery = exports.FxSqlQuery || (exports.FxSqlQuery = {}));
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
import { FxSqlAggregation } from "./Aggregation";
|
|
2
|
+
import { FxSqlQueryComparator } from "./Comparators";
|
|
3
|
+
import { FxSqlQueryDialect } from "./Dialect";
|
|
4
|
+
import { FxSqlQueryHelpler } from "./Helper";
|
|
5
|
+
import { FxSqlQuerySubQuery } from "./SubQuery";
|
|
6
|
+
import { FxSqlQuery } from './Query';
|
|
7
|
+
export declare namespace FxSqlQuerySql {
|
|
8
|
+
type DataToSet = {
|
|
9
|
+
[key: string]: any;
|
|
10
|
+
};
|
|
11
|
+
type SqlResultStr = string;
|
|
12
|
+
type SqlFragmentStr = string;
|
|
13
|
+
type SqlQueryStr = string;
|
|
14
|
+
type SqlEscapeArgType = string | number | boolean | Date | String | Number | RegExp | Symbol;
|
|
15
|
+
type SqlEscapeArgIdType = string | number;
|
|
16
|
+
type SqlAssignmentValues = SqlEscapeArgType[];
|
|
17
|
+
type SqlAssignmentTuple = [FxSqlQuerySql.SqlFragmentStr, [...SqlAssignmentValues]?];
|
|
18
|
+
type SqlFromTableInput = import('../../knex/types').Knex.Raw | import('../../knex/types').Knex.QueryBuilder;
|
|
19
|
+
type SqlTableTuple = [table: string | `(${string})` | SqlFromTableInput, alis: string];
|
|
20
|
+
type SqlTableInputType = string | SqlFromTableInput | SqlTableTuple;
|
|
21
|
+
type WhereObj = {
|
|
22
|
+
str: string;
|
|
23
|
+
escapes: any[];
|
|
24
|
+
};
|
|
25
|
+
type WhereExistsLinkTuple_L1 = FxSqlQueryHelpler.BinaryTuple<string>;
|
|
26
|
+
type WhereExistsLinkTuple_L2 = FxSqlQueryHelpler.BinaryTuple<string[]>;
|
|
27
|
+
type WhereExistsLinkTuple = WhereExistsLinkTuple_L1 | WhereExistsLinkTuple_L2;
|
|
28
|
+
interface DetailedQueryWhereCondition<T = any> extends FxSqlQueryComparator.QueryComparatorObject<T> {
|
|
29
|
+
from: string;
|
|
30
|
+
to: string;
|
|
31
|
+
expr: FxSqlQueryComparator.QueryComparatorExprType;
|
|
32
|
+
val: T;
|
|
33
|
+
where: WhereObj;
|
|
34
|
+
}
|
|
35
|
+
type DetailedQueryWhereCondition__InStyle = DetailedQueryWhereCondition<FxSqlQueryComparator.InputValue_in['in'] | FxSqlQueryComparator.InputValue_not_in['not_in']>;
|
|
36
|
+
interface QueryWhereConjunctionHash {
|
|
37
|
+
or?: FxSqlQueryComparator.Input[];
|
|
38
|
+
and?: FxSqlQueryComparator.Input[];
|
|
39
|
+
not_or?: FxSqlQueryComparator.Input[];
|
|
40
|
+
not_and?: FxSqlQueryComparator.Input[];
|
|
41
|
+
not?: FxSqlQueryComparator.Input[];
|
|
42
|
+
}
|
|
43
|
+
interface QueryWhereExtendItem {
|
|
44
|
+
table: string;
|
|
45
|
+
link_info: FxSqlQueryHelpler.Arraiable<any>;
|
|
46
|
+
table_linked: string;
|
|
47
|
+
}
|
|
48
|
+
type SqlColumnDescriptorDataType = any;
|
|
49
|
+
interface SqlColumnDescriptor {
|
|
50
|
+
data: SqlColumnDescriptorDataType;
|
|
51
|
+
type?(): string;
|
|
52
|
+
}
|
|
53
|
+
type NormalizedSimpleSqlColumnType = string | '*';
|
|
54
|
+
type SqlColumnType = (SqlColumnDescriptor | string)[] | NormalizedSimpleSqlColumnType;
|
|
55
|
+
interface SqlSelectFieldItemDescriptor {
|
|
56
|
+
/**
|
|
57
|
+
* @description fun name
|
|
58
|
+
*/
|
|
59
|
+
func_name?: string;
|
|
60
|
+
/**
|
|
61
|
+
* @description column name
|
|
62
|
+
* expect NO table prefix
|
|
63
|
+
*
|
|
64
|
+
* ```
|
|
65
|
+
* recommended: `col`
|
|
66
|
+
* ```
|
|
67
|
+
*
|
|
68
|
+
* but this allowed also
|
|
69
|
+
*
|
|
70
|
+
* ```
|
|
71
|
+
* allowed also: `table.col`
|
|
72
|
+
* ````
|
|
73
|
+
*
|
|
74
|
+
*/
|
|
75
|
+
column_name?: SqlColumnType;
|
|
76
|
+
/**
|
|
77
|
+
* @description column as
|
|
78
|
+
*/
|
|
79
|
+
as?: FxSqlQuerySql.NormalizedSimpleSqlColumnType;
|
|
80
|
+
a?: SqlSelectFieldItemDescriptor['as'];
|
|
81
|
+
/**
|
|
82
|
+
* @description fun_stack
|
|
83
|
+
*/
|
|
84
|
+
func_stack?: FxSqlAggregation.SupportedAggregationFunction[];
|
|
85
|
+
/**
|
|
86
|
+
* @description pure sql
|
|
87
|
+
*/
|
|
88
|
+
sql?: string;
|
|
89
|
+
/**
|
|
90
|
+
* @description GUESS: useful when this object refer to one complex descriptor?
|
|
91
|
+
*/
|
|
92
|
+
select?: string;
|
|
93
|
+
/**
|
|
94
|
+
* @description having sub query statement
|
|
95
|
+
*/
|
|
96
|
+
having?: string;
|
|
97
|
+
}
|
|
98
|
+
interface SqlSelectFieldsGenerator {
|
|
99
|
+
(dialect: FxSqlQueryDialect.Dialect): string;
|
|
100
|
+
}
|
|
101
|
+
type SqlSelectFieldsType = SqlFragmentStr | SqlSelectFieldItemDescriptor | SqlSelectFieldsGenerator;
|
|
102
|
+
interface QueryFromDescriptorOpts {
|
|
103
|
+
joinType: string;
|
|
104
|
+
}
|
|
105
|
+
interface QueryFromDescriptor {
|
|
106
|
+
table: string | import('../../knex/types').Knex.Raw | import('../../knex/types').Knex.QueryBuilder;
|
|
107
|
+
alias: string;
|
|
108
|
+
a?: string;
|
|
109
|
+
joins?: QueryFromJoinTupleDescriptor[];
|
|
110
|
+
select?: SqlSelectFieldsType[];
|
|
111
|
+
opts?: QueryFromDescriptorOpts;
|
|
112
|
+
}
|
|
113
|
+
type QueryFromJoinTupleDescriptor = [
|
|
114
|
+
string,
|
|
115
|
+
string,
|
|
116
|
+
string
|
|
117
|
+
];
|
|
118
|
+
type SqlTableOrderTuple = [
|
|
119
|
+
string,
|
|
120
|
+
string
|
|
121
|
+
];
|
|
122
|
+
interface SqlOrderDescriptor {
|
|
123
|
+
c: string | SqlTableOrderTuple;
|
|
124
|
+
d: 'DESC' | 'ASC';
|
|
125
|
+
}
|
|
126
|
+
type SqlOrderPayloadType = SqlOrderDescriptor | FxSqlQuery.OrderSqlStyleTuple[0];
|
|
127
|
+
type SqlGroupByType = string;
|
|
128
|
+
interface SqlFoundRowItem {
|
|
129
|
+
[k: string]: any;
|
|
130
|
+
}
|
|
131
|
+
interface SqlQueryChainDescriptor {
|
|
132
|
+
from?: QueryFromDescriptor[];
|
|
133
|
+
table?: string;
|
|
134
|
+
set?: DataToSet;
|
|
135
|
+
where?: FxSqlQuerySubQuery.SubQueryBuildDescriptor[];
|
|
136
|
+
order?: SqlOrderPayloadType[];
|
|
137
|
+
offset?: number;
|
|
138
|
+
limit?: number;
|
|
139
|
+
found_rows?: SqlFoundRowItem[] | boolean;
|
|
140
|
+
group_by?: SqlGroupByType[];
|
|
141
|
+
where_exists?: boolean;
|
|
142
|
+
}
|
|
143
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { FxSqlQueryComparator } from "./Comparators";
|
|
2
|
+
import { FxSqlQuerySql } from "./Sql";
|
|
3
|
+
export declare namespace FxSqlQuerySubQuery {
|
|
4
|
+
interface SubQueryBuildDescriptor {
|
|
5
|
+
table: string;
|
|
6
|
+
/**
|
|
7
|
+
* there may be 3 kinds of normalized key-value:
|
|
8
|
+
* - FxSqlQueryComparator.SubQueryInput[]
|
|
9
|
+
* - FxSqlQueryComparator.InputValueType
|
|
10
|
+
* - FxSqlQueryComparator.QueryComparatorObject
|
|
11
|
+
* - FxSqlQueryComparator.QueryComparatorLiteralObject
|
|
12
|
+
*/
|
|
13
|
+
wheres: {
|
|
14
|
+
[k: string]: ConjunctionInputValue | NonConjunctionInputValue;
|
|
15
|
+
};
|
|
16
|
+
exists?: FxSqlQuerySql.QueryWhereExtendItem;
|
|
17
|
+
}
|
|
18
|
+
type SubQueryConditions = SubQueryBuildDescriptor['wheres'];
|
|
19
|
+
type UnderscoreSqlInput = [FxSqlQuerySql.SqlAssignmentTuple];
|
|
20
|
+
type ConjunctionInputValue = FxSqlQueryComparator.SubQueryInput[];
|
|
21
|
+
type NonConjunctionInputValue = FxSqlQueryComparator.InputValueType | FxSqlQueryComparator.QueryComparatorObject | FxSqlQueryComparator.QueryComparatorLiteralObject | UnderscoreSqlInput;
|
|
22
|
+
type WhereExistsTuple_Flatten = [
|
|
23
|
+
string,
|
|
24
|
+
FxSqlQueryComparator.SubQueryInput,
|
|
25
|
+
string,
|
|
26
|
+
FxSqlQueryComparator.SubQueryInput
|
|
27
|
+
];
|
|
28
|
+
interface ConjunctionInput__Sample {
|
|
29
|
+
or?: FxSqlQueryComparator.SubQueryInput[];
|
|
30
|
+
and?: FxSqlQueryComparator.SubQueryInput[];
|
|
31
|
+
not_or?: FxSqlQueryComparator.SubQueryInput[];
|
|
32
|
+
not_and?: FxSqlQueryComparator.SubQueryInput[];
|
|
33
|
+
not?: FxSqlQueryComparator.SubQueryInput[];
|
|
34
|
+
}
|
|
35
|
+
type KeyOf_ConjunctionInput = keyof ConjunctionInput__Sample;
|
|
36
|
+
interface NonConjunctionInput__Sample {
|
|
37
|
+
[k: string]: FxSqlQueryComparator.InputValueType;
|
|
38
|
+
}
|
|
39
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export type { FxSqlAggregation } from './Aggregation';
|
|
2
|
+
export type { FxSqlQueryComparator, FxSqlQueryComparatorFunction } from './Comparators';
|
|
3
|
+
export type { FxSqlQueryDialect } from './Dialect';
|
|
4
|
+
export type { FxSqlQueryColumns } from './Field';
|
|
5
|
+
export type { FxSqlQueryHelpler } from './Helper';
|
|
6
|
+
export type { FxSqlQueryChainBuilder } from './Query-ChainBuilder';
|
|
7
|
+
export type { FxSqlQuery } from './Query';
|
|
8
|
+
export type { FxSqlQuerySql } from './Sql';
|
|
9
|
+
export type { FxSqlQuerySubQuery } from './SubQuery';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { FxSqlQuerySql } from "./Typo/Sql";
|
|
2
|
+
import { FxSqlQuery } from "./Typo/Query";
|
|
3
|
+
import { FxSqlQueryDialect } from "./Typo/Dialect";
|
|
4
|
+
import { FxSqlQuerySubQuery } from "./Typo/SubQuery";
|
|
5
|
+
import { FxSqlQueryChainBuilder } from "./Typo/Query-ChainBuilder";
|
|
6
|
+
import { ChainBuilderBase } from "./Helpers";
|
|
7
|
+
export declare class UpdateQuery extends ChainBuilderBase implements FxSqlQueryChainBuilder.ChainBuilder__Update {
|
|
8
|
+
private opts;
|
|
9
|
+
private sql;
|
|
10
|
+
constructor(Dialect: FxSqlQueryDialect.Dialect, opts: FxSqlQuery.QueryOptions);
|
|
11
|
+
into(table: string): this;
|
|
12
|
+
set(values: FxSqlQuerySql.DataToSet): this;
|
|
13
|
+
where(...whereConditions: FxSqlQuerySubQuery.SubQueryBuildDescriptor['wheres'][]): this;
|
|
14
|
+
build(): string;
|
|
15
|
+
}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
2
|
+
exports.UpdateQuery = void 0;
|
|
3
|
+
const UpdateSet = require("./Set");
|
|
4
|
+
const Where = require("./Where");
|
|
5
|
+
const Helpers_1 = require("./Helpers");
|
|
6
|
+
class UpdateQuery extends Helpers_1.ChainBuilderBase {
|
|
7
|
+
constructor(Dialect, opts) {
|
|
8
|
+
super(Dialect);
|
|
9
|
+
this.opts = opts;
|
|
10
|
+
this.sql = {
|
|
11
|
+
where: []
|
|
12
|
+
};
|
|
13
|
+
}
|
|
14
|
+
into(table) {
|
|
15
|
+
this.sql.table = table;
|
|
16
|
+
return this;
|
|
17
|
+
}
|
|
18
|
+
set(values) {
|
|
19
|
+
this.sql.set = values;
|
|
20
|
+
return this;
|
|
21
|
+
}
|
|
22
|
+
where(...whereConditions) {
|
|
23
|
+
for (let i = 0; i < whereConditions.length; i++) {
|
|
24
|
+
this.sql.where.push({
|
|
25
|
+
table: null,
|
|
26
|
+
wheres: whereConditions[i]
|
|
27
|
+
});
|
|
28
|
+
}
|
|
29
|
+
return this;
|
|
30
|
+
}
|
|
31
|
+
build() {
|
|
32
|
+
const sqlBuilder = this.Dialect.knex(this.sql.table);
|
|
33
|
+
UpdateSet.build(sqlBuilder, this.Dialect, this.sql.set, this.opts);
|
|
34
|
+
Where.build(sqlBuilder, this.Dialect, this.sql.where, this.opts);
|
|
35
|
+
return sqlBuilder.toQuery();
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
exports.UpdateQuery = UpdateQuery;
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import { FxSqlQuerySubQuery } from './Typo/SubQuery';
|
|
2
|
+
import { FxSqlQueryDialect } from './Typo/Dialect';
|
|
3
|
+
import { FxSqlQueryChainBuilder } from './Typo/Query-ChainBuilder';
|
|
4
|
+
export declare function build(knexQueryBuilder: import('../knex/types').Knex.QueryBuilder, Dialect: FxSqlQueryDialect.Dialect, whereList: FxSqlQuerySubQuery.SubQueryBuildDescriptor[], opts: FxSqlQueryChainBuilder.ChainBuilderOptions): void;
|