baja-lite 1.2.2 → 1.3.2
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/boot-remote.js +2 -1
- package/boot.js +2 -1
- package/index.d.ts +1 -1
- package/index.js +1 -1
- package/package.json +16 -15
- package/sql.d.ts +7 -84
- package/sql.js +30 -276
- package/test-mysql.js +2 -1
- package/test-postgresql.js +2 -1
- package/test-sqlite.js +2 -1
- package/validate.d.ts +170 -0
- package/validate.js +378 -0
- package/wx/mini.d.ts +2 -2
- package/wx/mini.js +1 -1
- package/wx/organ.d.ts +2 -2
- package/wx/organ.js +1 -1
- package/set-ex.d.ts +0 -198
- package/set-ex.js +0 -338
package/boot-remote.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { DBType, _Hump } from 'baja-lite-field';
|
|
1
2
|
import { getEnums } from './enum.js';
|
|
2
|
-
import {
|
|
3
|
+
import { ColumnMode, SqlCache, SqliteRemote, _GlobalSqlOption, _dao, _defOption, _enums, _primaryDB, _sqlCache, logger } from './sql.js';
|
|
3
4
|
export const BootRomote = async function (options) {
|
|
4
5
|
globalThis[_GlobalSqlOption] = Object.assign({}, _defOption, options);
|
|
5
6
|
globalThis[_Hump] = globalThis[_GlobalSqlOption].columnMode === ColumnMode.HUMP;
|
package/boot.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
|
+
import { _Hump, DBType } from 'baja-lite-field';
|
|
1
2
|
import { getEnums } from './enum.js';
|
|
2
|
-
import {
|
|
3
|
+
import { _dao, _defOption, _enums, _EventBus, _fs, _GlobalSqlOption, _path, _primaryDB, _sqlCache, ColumnMode, logger, Mysql, Postgresql, SqlCache, Sqlite, SqliteRemote } from './sql.js';
|
|
3
4
|
export const Boot = async function (options) {
|
|
4
5
|
globalThis[_GlobalSqlOption] = Object.assign({}, _defOption, options);
|
|
5
6
|
globalThis[_Hump] = globalThis[_GlobalSqlOption].columnMode === ColumnMode.HUMP;
|
package/index.d.ts
CHANGED
|
@@ -5,8 +5,8 @@ export * from './fn.js';
|
|
|
5
5
|
export * from './list.js';
|
|
6
6
|
export * from './math.js';
|
|
7
7
|
export * from './object.js';
|
|
8
|
-
export * from './set-ex.js';
|
|
9
8
|
export * from './snowflake.js';
|
|
10
9
|
export * from './sql.js';
|
|
11
10
|
export * from './sqlite.js';
|
|
12
11
|
export * from './string.js';
|
|
12
|
+
export * from './validate.js';
|
package/index.js
CHANGED
|
@@ -5,8 +5,8 @@ export * from './fn.js';
|
|
|
5
5
|
export * from './list.js';
|
|
6
6
|
export * from './math.js';
|
|
7
7
|
export * from './object.js';
|
|
8
|
-
export * from './set-ex.js';
|
|
9
8
|
export * from './snowflake.js';
|
|
10
9
|
export * from './sql.js';
|
|
11
10
|
export * from './sqlite.js';
|
|
12
11
|
export * from './string.js';
|
|
12
|
+
export * from './validate.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "baja-lite",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.3.2",
|
|
4
4
|
"description": "some util for self",
|
|
5
5
|
"homepage": "https://github.com/void-soul/util-man",
|
|
6
6
|
"repository": {
|
|
@@ -23,7 +23,6 @@
|
|
|
23
23
|
"bin": {
|
|
24
24
|
"baja": "./code.js"
|
|
25
25
|
},
|
|
26
|
-
"models": "./index.js",
|
|
27
26
|
"scripts": {
|
|
28
27
|
"dist": "node ./ci.js",
|
|
29
28
|
"mysql": "bun --inspect ./src/test-mysql.ts",
|
|
@@ -31,14 +30,15 @@
|
|
|
31
30
|
"postgres": "bun --inspect ./src/test-postgresql.ts",
|
|
32
31
|
"postgres2": "node inspect ./dist/cjs/test-postgresql.js",
|
|
33
32
|
"sqlite": "node inspect ./dist/cjs/test-sqlite.js",
|
|
34
|
-
"xml": "bun --inspect ./src/test-xml.ts",
|
|
35
33
|
"test": "bun --inspect ./src/test.ts",
|
|
36
|
-
"test2": "node inspect ./dist/cjs/tes.js"
|
|
34
|
+
"test2": "node inspect ./dist/cjs/tes.js",
|
|
35
|
+
"xml": "bun --inspect ./src/test-xml.ts"
|
|
37
36
|
},
|
|
38
37
|
"dependencies": {
|
|
39
|
-
"@msgpack/msgpack": "3.1.
|
|
38
|
+
"@msgpack/msgpack": "3.1.1",
|
|
40
39
|
"@types/request-promise": "4.1.51",
|
|
41
|
-
"axios": "1.8.
|
|
40
|
+
"axios": "1.8.4",
|
|
41
|
+
"baja-lite-field": "1.3.2",
|
|
42
42
|
"decimal.js": "10.5.0",
|
|
43
43
|
"html-parse-stringify": "3.0.1",
|
|
44
44
|
"iterare": "1.2.1",
|
|
@@ -57,18 +57,18 @@
|
|
|
57
57
|
"@types/better-sqlite3": "7.6.12",
|
|
58
58
|
"@types/lodash.get": "4.4.9",
|
|
59
59
|
"@types/mustache": "4.2.5",
|
|
60
|
-
"@types/node": "22.13.
|
|
60
|
+
"@types/node": "22.13.10",
|
|
61
61
|
"@types/pg-pool": "2.0.6",
|
|
62
62
|
"@types/shelljs": "0.8.15",
|
|
63
63
|
"@types/sqlstring": "2.3.2",
|
|
64
|
-
"@typescript-eslint/eslint-plugin": "8.
|
|
65
|
-
"@typescript-eslint/parser": "8.
|
|
66
|
-
"better-sqlite3": "11.
|
|
64
|
+
"@typescript-eslint/eslint-plugin": "8.27.0",
|
|
65
|
+
"@typescript-eslint/parser": "8.27.0",
|
|
66
|
+
"better-sqlite3": "11.9.1",
|
|
67
67
|
"ioredis": "5.6.0",
|
|
68
|
-
"mongodb": "6.
|
|
69
|
-
"mysql2": "3.
|
|
70
|
-
"pg": "8.
|
|
71
|
-
"pg-pool": "3.
|
|
68
|
+
"mongodb": "6.15.0",
|
|
69
|
+
"mysql2": "3.14.0",
|
|
70
|
+
"pg": "8.14.1",
|
|
71
|
+
"pg-pool": "3.8.0",
|
|
72
72
|
"redlock": "5.0.0-beta.2",
|
|
73
73
|
"shelljs": "0.8.5",
|
|
74
74
|
"typescript": "5.7.3"
|
|
@@ -78,5 +78,6 @@
|
|
|
78
78
|
},
|
|
79
79
|
"publishConfig": {
|
|
80
80
|
"access": "public"
|
|
81
|
-
}
|
|
81
|
+
},
|
|
82
|
+
"models": "./index.js"
|
|
82
83
|
}
|
package/sql.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { ExtensionCodec } from "@msgpack/msgpack";
|
|
2
|
+
import { _columns, _columnsNoId, _def, _deleteState, _fields, _ids, _index, _logicIds, _stateFileName, AField, DBType, FieldOption } from 'baja-lite-field';
|
|
2
3
|
import { XML } from './convert-xml.js';
|
|
3
4
|
import { EnumMap } from './enum.js';
|
|
4
5
|
import { ArrayList } from './list.js';
|
|
@@ -8,16 +9,7 @@ declare const _tableName: unique symbol;
|
|
|
8
9
|
declare const _className: unique symbol;
|
|
9
10
|
declare const _ClassName: unique symbol;
|
|
10
11
|
declare const _vueName: unique symbol;
|
|
11
|
-
declare const _ids: unique symbol;
|
|
12
|
-
declare const _logicIds: unique symbol;
|
|
13
|
-
declare const _columns: unique symbol;
|
|
14
|
-
declare const _columnsNoId: unique symbol;
|
|
15
|
-
declare const _fields: unique symbol;
|
|
16
|
-
declare const _stateFileName: unique symbol;
|
|
17
|
-
declare const _deleteState: unique symbol;
|
|
18
12
|
declare const _transformer: unique symbol;
|
|
19
|
-
declare const _index: unique symbol;
|
|
20
|
-
declare const _def: unique symbol;
|
|
21
13
|
declare const _comment: unique symbol;
|
|
22
14
|
export declare const _sqlCache: unique symbol;
|
|
23
15
|
export declare const _dao: unique symbol;
|
|
@@ -30,21 +22,11 @@ declare const _daoDB: unique symbol;
|
|
|
30
22
|
declare const _sqliteRemoteName: unique symbol;
|
|
31
23
|
declare const _SqlOption: unique symbol;
|
|
32
24
|
export declare const _enums: unique symbol;
|
|
33
|
-
export declare const _Hump: unique symbol;
|
|
34
25
|
export declare const _GlobalSqlOption: unique symbol;
|
|
35
26
|
export declare const _EventBus: unique symbol;
|
|
36
27
|
export declare const _path: unique symbol;
|
|
37
28
|
export declare const _fs: unique symbol;
|
|
38
29
|
export declare const logger: import("pino").Logger<never, boolean>;
|
|
39
|
-
export declare enum DBType {
|
|
40
|
-
Mysql = 0,
|
|
41
|
-
Postgresql = 1,
|
|
42
|
-
Sqlite = 2,
|
|
43
|
-
Mongo = 3,
|
|
44
|
-
SqliteRemote = 4,
|
|
45
|
-
Redis = 5,
|
|
46
|
-
RedisLock = 6
|
|
47
|
-
}
|
|
48
30
|
export declare enum MapperIfUndefined {
|
|
49
31
|
Null = 0,
|
|
50
32
|
Skip = 1,
|
|
@@ -135,32 +117,6 @@ export declare enum SelectResult {
|
|
|
135
117
|
/** 多行多列并封装ArrayList */
|
|
136
118
|
RS_CS_List = 7
|
|
137
119
|
}
|
|
138
|
-
export declare enum SqlType {
|
|
139
|
-
tinyint = 0,
|
|
140
|
-
smallint = 1,
|
|
141
|
-
mediumint = 2,
|
|
142
|
-
int = 3,
|
|
143
|
-
bigint = 4,
|
|
144
|
-
float = 5,
|
|
145
|
-
double = 6,
|
|
146
|
-
decimal = 7,
|
|
147
|
-
date = 8,
|
|
148
|
-
time = 9,
|
|
149
|
-
year = 10,
|
|
150
|
-
datetime = 11,
|
|
151
|
-
timestamp = 12,
|
|
152
|
-
char = 13,
|
|
153
|
-
varchar = 14,
|
|
154
|
-
tinyblob = 15,
|
|
155
|
-
tinytext = 16,
|
|
156
|
-
blob = 17,
|
|
157
|
-
text = 18,
|
|
158
|
-
mediumblob = 19,
|
|
159
|
-
mediumtext = 20,
|
|
160
|
-
longblob = 21,
|
|
161
|
-
longtext = 22,
|
|
162
|
-
json = 23
|
|
163
|
-
}
|
|
164
120
|
export declare enum ColumnMode {
|
|
165
121
|
NONE = 0,
|
|
166
122
|
HUMP = 1
|
|
@@ -490,44 +446,6 @@ export interface GlobalSqlOption extends GlobalSqlOptionForWeb {
|
|
|
490
446
|
*/
|
|
491
447
|
jsMode?: boolean;
|
|
492
448
|
}
|
|
493
|
-
interface FieldOption extends Object {
|
|
494
|
-
type?: SqlType;
|
|
495
|
-
/** @deprecated 属性名称:TS注解不需要,JS手动注入需要 */
|
|
496
|
-
P?: string;
|
|
497
|
-
length?: number;
|
|
498
|
-
scale?: number;
|
|
499
|
-
def?: any;
|
|
500
|
-
index?: boolean;
|
|
501
|
-
id?: boolean;
|
|
502
|
-
logicDelete?: string | number;
|
|
503
|
-
/** 是否逻辑唯一,用于导入时检测数据是否存在 */
|
|
504
|
-
logicId?: boolean;
|
|
505
|
-
/** 仅在生成 表时有效 */
|
|
506
|
-
notNull?: boolean;
|
|
507
|
-
/** 注释,影响到默认导出导入标题 */
|
|
508
|
-
comment?: string;
|
|
509
|
-
/** 可以导入的字段,默认TRUE,ID默认FALSE */
|
|
510
|
-
importable?: boolean;
|
|
511
|
-
/** 可以导出的字段,默认TRUE,ID默认FALSE */
|
|
512
|
-
exportable?: boolean;
|
|
513
|
-
/** sqlite 无效,与UUID只能有一个 */
|
|
514
|
-
uuidShort?: boolean;
|
|
515
|
-
/** 与uuidShort只能有一个 */
|
|
516
|
-
uuid?: boolean;
|
|
517
|
-
}
|
|
518
|
-
interface AField extends FieldOption {
|
|
519
|
-
/** 安全列名 */
|
|
520
|
-
C2: () => string;
|
|
521
|
-
/** @deprecated 数据列名称 */
|
|
522
|
-
C?: () => string;
|
|
523
|
-
/** 查询用:b_id bId */
|
|
524
|
-
C3: () => string;
|
|
525
|
-
[DBType.Postgresql]: () => string;
|
|
526
|
-
[DBType.Mysql]: () => string;
|
|
527
|
-
[DBType.Sqlite]: () => string;
|
|
528
|
-
[DBType.SqliteRemote]: () => string;
|
|
529
|
-
Data2SQL: (data: any) => any;
|
|
530
|
-
}
|
|
531
449
|
export interface PageQuery<L> {
|
|
532
450
|
sum?: Record<string, number>;
|
|
533
451
|
total?: number;
|
|
@@ -743,7 +661,6 @@ export declare class SqlCache {
|
|
|
743
661
|
[k: string]: any;
|
|
744
662
|
}): string;
|
|
745
663
|
}
|
|
746
|
-
export declare const Field: (config: FieldOption) => (object: object, propertyName: string) => void;
|
|
747
664
|
export declare const DB: (config: ServiceOption) => <C extends {
|
|
748
665
|
new (...args: any[]): {};
|
|
749
666
|
}>(constructor: C) => {
|
|
@@ -1447,6 +1364,11 @@ declare class StreamQuery<T extends object> {
|
|
|
1447
1364
|
reset(): this;
|
|
1448
1365
|
/** 为下次链条执行提供条件判断:非异步方法跳过,异步方法不执行并返回默认值 */
|
|
1449
1366
|
if(condition: boolean): this;
|
|
1367
|
+
eqs(keys: (keyof T)[], value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1368
|
+
paramName?: string | undefined;
|
|
1369
|
+
skipEmptyString?: boolean | undefined;
|
|
1370
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1371
|
+
}): this;
|
|
1450
1372
|
eq(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1451
1373
|
paramName?: string | undefined;
|
|
1452
1374
|
skipEmptyString?: boolean | undefined;
|
|
@@ -1778,6 +1700,7 @@ declare class StreamQuery<T extends object> {
|
|
|
1778
1700
|
}): number;
|
|
1779
1701
|
private _where;
|
|
1780
1702
|
private _;
|
|
1703
|
+
private __;
|
|
1781
1704
|
private _null;
|
|
1782
1705
|
private _key;
|
|
1783
1706
|
private _between;
|
package/sql.js
CHANGED
|
@@ -10,6 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
|
10
10
|
var _b, _c, _d, _e;
|
|
11
11
|
var _f, _g, _h, _j;
|
|
12
12
|
import { decode, DecodeError, encode, ExtensionCodec } from "@msgpack/msgpack";
|
|
13
|
+
import { _columns, _columnsNoId, _def, _deleteState, _fields, _Hump, _ids, _index, _logicIds, _stateFileName, DBType, Field } from 'baja-lite-field';
|
|
13
14
|
import HTML from 'html-parse-stringify';
|
|
14
15
|
import * as ite from 'iterare';
|
|
15
16
|
import LGet from 'lodash.get';
|
|
@@ -57,16 +58,7 @@ const _tableName = Symbol('tableName');
|
|
|
57
58
|
const _className = Symbol('className');
|
|
58
59
|
const _ClassName = Symbol('ClassName');
|
|
59
60
|
const _vueName = Symbol('vueName');
|
|
60
|
-
const _ids = Symbol('ids');
|
|
61
|
-
const _logicIds = Symbol('logicIds');
|
|
62
|
-
const _columns = Symbol('columns');
|
|
63
|
-
const _columnsNoId = Symbol('columnsNoId');
|
|
64
|
-
const _fields = Symbol('fields');
|
|
65
|
-
const _stateFileName = Symbol('stateFileName');
|
|
66
|
-
const _deleteState = Symbol('deleteState');
|
|
67
61
|
const _transformer = Symbol('transformer');
|
|
68
|
-
const _index = Symbol('index');
|
|
69
|
-
const _def = Symbol('def');
|
|
70
62
|
const _comment = Symbol('comment');
|
|
71
63
|
export const _sqlCache = Symbol('sqlMap');
|
|
72
64
|
export const _dao = Symbol('dao');
|
|
@@ -81,7 +73,6 @@ const _SqlOption = Symbol('SqlOption');
|
|
|
81
73
|
const _resultMap = Symbol('resultMap');
|
|
82
74
|
const _resultMap_SQLID = Symbol('resultMap_SQLID');
|
|
83
75
|
export const _enums = Symbol('_enums');
|
|
84
|
-
export const _Hump = Symbol('Hump');
|
|
85
76
|
export const _GlobalSqlOption = Symbol('GlobalSqlOption');
|
|
86
77
|
export const _EventBus = Symbol('EventBus');
|
|
87
78
|
export const _path = Symbol('path');
|
|
@@ -95,17 +86,6 @@ export const logger = process.env['NODE_ENV'] !== 'production' ? pino({
|
|
|
95
86
|
globalThis[_resultMap_SQLID] = {};
|
|
96
87
|
// #endregion
|
|
97
88
|
// #region 可选配置
|
|
98
|
-
export var DBType;
|
|
99
|
-
(function (DBType) {
|
|
100
|
-
DBType[DBType["Mysql"] = 0] = "Mysql";
|
|
101
|
-
DBType[DBType["Postgresql"] = 1] = "Postgresql";
|
|
102
|
-
DBType[DBType["Sqlite"] = 2] = "Sqlite";
|
|
103
|
-
DBType[DBType["Mongo"] = 3] = "Mongo";
|
|
104
|
-
DBType[DBType["SqliteRemote"] = 4] = "SqliteRemote";
|
|
105
|
-
DBType[DBType["Redis"] = 5] = "Redis";
|
|
106
|
-
DBType[DBType["RedisLock"] = 6] = "RedisLock";
|
|
107
|
-
})(DBType || (DBType = {}));
|
|
108
|
-
;
|
|
109
89
|
export var MapperIfUndefined;
|
|
110
90
|
(function (MapperIfUndefined) {
|
|
111
91
|
MapperIfUndefined[MapperIfUndefined["Null"] = 0] = "Null";
|
|
@@ -214,33 +194,6 @@ export var SelectResult;
|
|
|
214
194
|
/** 多行多列并封装ArrayList */
|
|
215
195
|
SelectResult[SelectResult["RS_CS_List"] = 7] = "RS_CS_List";
|
|
216
196
|
})(SelectResult || (SelectResult = {}));
|
|
217
|
-
export var SqlType;
|
|
218
|
-
(function (SqlType) {
|
|
219
|
-
SqlType[SqlType["tinyint"] = 0] = "tinyint";
|
|
220
|
-
SqlType[SqlType["smallint"] = 1] = "smallint";
|
|
221
|
-
SqlType[SqlType["mediumint"] = 2] = "mediumint";
|
|
222
|
-
SqlType[SqlType["int"] = 3] = "int";
|
|
223
|
-
SqlType[SqlType["bigint"] = 4] = "bigint";
|
|
224
|
-
SqlType[SqlType["float"] = 5] = "float";
|
|
225
|
-
SqlType[SqlType["double"] = 6] = "double";
|
|
226
|
-
SqlType[SqlType["decimal"] = 7] = "decimal";
|
|
227
|
-
SqlType[SqlType["date"] = 8] = "date";
|
|
228
|
-
SqlType[SqlType["time"] = 9] = "time";
|
|
229
|
-
SqlType[SqlType["year"] = 10] = "year";
|
|
230
|
-
SqlType[SqlType["datetime"] = 11] = "datetime";
|
|
231
|
-
SqlType[SqlType["timestamp"] = 12] = "timestamp";
|
|
232
|
-
SqlType[SqlType["char"] = 13] = "char";
|
|
233
|
-
SqlType[SqlType["varchar"] = 14] = "varchar";
|
|
234
|
-
SqlType[SqlType["tinyblob"] = 15] = "tinyblob";
|
|
235
|
-
SqlType[SqlType["tinytext"] = 16] = "tinytext";
|
|
236
|
-
SqlType[SqlType["blob"] = 17] = "blob";
|
|
237
|
-
SqlType[SqlType["text"] = 18] = "text";
|
|
238
|
-
SqlType[SqlType["mediumblob"] = 19] = "mediumblob";
|
|
239
|
-
SqlType[SqlType["mediumtext"] = 20] = "mediumtext";
|
|
240
|
-
SqlType[SqlType["longblob"] = 21] = "longblob";
|
|
241
|
-
SqlType[SqlType["longtext"] = 22] = "longtext";
|
|
242
|
-
SqlType[SqlType["json"] = 23] = "json";
|
|
243
|
-
})(SqlType || (SqlType = {}));
|
|
244
197
|
export var ColumnMode;
|
|
245
198
|
(function (ColumnMode) {
|
|
246
199
|
ColumnMode[ColumnMode["NONE"] = 0] = "NONE";
|
|
@@ -1974,233 +1927,6 @@ const FieldFilter = (K, V, def, uuidColumn, option) => {
|
|
|
1974
1927
|
}
|
|
1975
1928
|
return [ret, V];
|
|
1976
1929
|
};
|
|
1977
|
-
const MYSQLCHARSET = `CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci`;
|
|
1978
|
-
const POSTGRESCHARSET = `COLLATE "pg_catalog"."default"`;
|
|
1979
|
-
export const Field = (config) => {
|
|
1980
|
-
config.type ?? (config.type = SqlType.varchar);
|
|
1981
|
-
return (object, propertyName) => {
|
|
1982
|
-
const field = config;
|
|
1983
|
-
field.P = propertyName;
|
|
1984
|
-
field.C = () => P2C(propertyName, globalThis[_Hump]);
|
|
1985
|
-
field.C2 = () => P2C(propertyName, globalThis[_Hump]);
|
|
1986
|
-
field.C3 = () => `${P2C(propertyName, globalThis[_Hump])} ${propertyName}`;
|
|
1987
|
-
const hasDef = field.hasOwnProperty('def') === true;
|
|
1988
|
-
switch (field.type) {
|
|
1989
|
-
case SqlType.tinyint: {
|
|
1990
|
-
field[DBType.Mysql] = () => `${field.C2()} tinyint ${config.notNull === true ? 'NOT NULL' : ''} ${hasDef ? `DEFAULT ${field.def}` : ''}`;
|
|
1991
|
-
field[DBType.Postgresql] = () => `${field.C2()} int2 ${config.notNull === true ? 'NOT NULL' : ''} ${hasDef ? `DEFAULT ${field.def}` : ''}`;
|
|
1992
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} integer`;
|
|
1993
|
-
break;
|
|
1994
|
-
}
|
|
1995
|
-
case SqlType.smallint: {
|
|
1996
|
-
field[DBType.Mysql] = () => `${field.C2()} smallint ${config.notNull === true ? 'NOT NULL' : ''} ${hasDef ? `DEFAULT ${field.def}` : ''}`;
|
|
1997
|
-
field[DBType.Postgresql] = () => `${field.C2()} int2 ${config.notNull === true ? 'NOT NULL' : ''} ${hasDef ? `DEFAULT ${field.def}` : ''}`;
|
|
1998
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} integer`;
|
|
1999
|
-
break;
|
|
2000
|
-
}
|
|
2001
|
-
case SqlType.mediumint: {
|
|
2002
|
-
field[DBType.Mysql] = () => `${field.C2()} smallint ${config.notNull === true ? 'NOT NULL' : ''} ${hasDef ? `DEFAULT ${field.def}` : ''}`;
|
|
2003
|
-
field[DBType.Postgresql] = () => `${field.C2()} int4 ${config.notNull === true ? 'NOT NULL' : ''} ${hasDef ? `DEFAULT ${field.def}` : ''}`;
|
|
2004
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} integer`;
|
|
2005
|
-
break;
|
|
2006
|
-
}
|
|
2007
|
-
case SqlType.int: {
|
|
2008
|
-
field[DBType.Mysql] = () => `${field.C2()} int ${config.notNull === true ? 'NOT NULL' : ''} ${hasDef ? `DEFAULT ${field.def}` : ''}`;
|
|
2009
|
-
field[DBType.Postgresql] = () => `${field.C2()} int4 ${config.notNull === true ? 'NOT NULL' : ''} ${hasDef ? `DEFAULT ${field.def}` : ''}`;
|
|
2010
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} integer`;
|
|
2011
|
-
break;
|
|
2012
|
-
}
|
|
2013
|
-
case SqlType.bigint: {
|
|
2014
|
-
field[DBType.Mysql] = () => `${field.C2()} bigint ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2015
|
-
field[DBType.Postgresql] = () => `${field.C2()} int8 ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2016
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} integer`;
|
|
2017
|
-
field.Data2SQL = (data) => BigInt(data ?? 0);
|
|
2018
|
-
break;
|
|
2019
|
-
}
|
|
2020
|
-
case SqlType.float: {
|
|
2021
|
-
field[DBType.Mysql] = () => `${field.C2()} float4(${config.length ?? 1}, ${config.scale ?? 2}) ${config.notNull === true ? 'NOT NULL' : ''} ${hasDef ? `DEFAULT '${field.def}'` : ''} `;
|
|
2022
|
-
field[DBType.Postgresql] = () => `${field.C2()} float4(${config.length ?? 1}, ${config.scale ?? 2}) ${config.notNull === true ? 'NOT NULL' : ''} ${hasDef ? `DEFAULT '${field.def}'` : ''} `;
|
|
2023
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} real`;
|
|
2024
|
-
break;
|
|
2025
|
-
}
|
|
2026
|
-
case SqlType.double: {
|
|
2027
|
-
field[DBType.Mysql] = () => `${field.C2()} double(${config.length ?? 1}, ${config.scale ?? 2}) ${config.notNull === true ? 'NOT NULL' : ''} ${hasDef ? `DEFAULT '${field.def}'` : ''} `;
|
|
2028
|
-
field[DBType.Postgresql] = () => `${field.C2()} float8(${config.length ?? 1}, ${config.scale ?? 2}) ${config.notNull === true ? 'NOT NULL' : ''} ${hasDef ? `DEFAULT '${field.def}'` : ''} `;
|
|
2029
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} real`;
|
|
2030
|
-
break;
|
|
2031
|
-
}
|
|
2032
|
-
case SqlType.decimal: {
|
|
2033
|
-
field[DBType.Mysql] = () => `${field.C2()} decimal(${config.length ?? 1}, ${config.scale ?? 2}) ${config.notNull === true ? 'NOT NULL' : ''} ${hasDef ? `DEFAULT '${field.def}'` : ''} `;
|
|
2034
|
-
field[DBType.Postgresql] = () => `${field.C2()} numeric(${config.length ?? 1}, ${config.scale ?? 2}) ${config.notNull === true ? 'NOT NULL' : ''} ${hasDef ? `DEFAULT '${field.def}'` : ''} `;
|
|
2035
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} real`;
|
|
2036
|
-
break;
|
|
2037
|
-
}
|
|
2038
|
-
case SqlType.longtext: {
|
|
2039
|
-
field[DBType.Mysql] = () => `${field.C2()} longtext ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2040
|
-
field[DBType.Postgresql] = () => `${field.C2()} text ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2041
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2042
|
-
break;
|
|
2043
|
-
}
|
|
2044
|
-
case SqlType.mediumtext: {
|
|
2045
|
-
field[DBType.Mysql] = () => `${field.C2()} mediumtext ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2046
|
-
field[DBType.Postgresql] = () => `${field.C2()} text ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2047
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2048
|
-
break;
|
|
2049
|
-
}
|
|
2050
|
-
case SqlType.text: {
|
|
2051
|
-
field[DBType.Mysql] = () => `${field.C2()} text ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2052
|
-
field[DBType.Postgresql] = () => `${field.C2()} text ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2053
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2054
|
-
break;
|
|
2055
|
-
}
|
|
2056
|
-
case SqlType.date: {
|
|
2057
|
-
field[DBType.Mysql] = () => `${field.C2()} date ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2058
|
-
field[DBType.Postgresql] = () => `${field.C2()} date ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2059
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2060
|
-
field.Data2SQL = (data) => typeof data === 'string' ? new Date(data) : data;
|
|
2061
|
-
break;
|
|
2062
|
-
}
|
|
2063
|
-
case SqlType.time: {
|
|
2064
|
-
field[DBType.Mysql] = () => `${field.C2()} time ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2065
|
-
field[DBType.Postgresql] = () => `${field.C2()} time ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2066
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2067
|
-
field.Data2SQL = (data) => typeof data === 'string' ? new Date(data) : data;
|
|
2068
|
-
break;
|
|
2069
|
-
}
|
|
2070
|
-
case SqlType.year: {
|
|
2071
|
-
field[DBType.Mysql] = () => `${field.C2()} year ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2072
|
-
field[DBType.Postgresql] = () => `${field.C2()} int4 ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2073
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2074
|
-
field.Data2SQL = (data) => typeof data === 'string' ? new Date(data) : data;
|
|
2075
|
-
break;
|
|
2076
|
-
}
|
|
2077
|
-
case SqlType.datetime: {
|
|
2078
|
-
field[DBType.Mysql] = () => `${field.C2()} datetime ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2079
|
-
field[DBType.Postgresql] = () => `${field.C2()} timestamp ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2080
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2081
|
-
field.Data2SQL = (data) => typeof data === 'string' ? new Date(data) : data;
|
|
2082
|
-
break;
|
|
2083
|
-
}
|
|
2084
|
-
case SqlType.timestamp: {
|
|
2085
|
-
field[DBType.Mysql] = () => `${field.C2()} timestamp ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2086
|
-
field[DBType.Postgresql] = () => `${field.C2()} timestamp ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2087
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} integer`;
|
|
2088
|
-
field.Data2SQL = (data) => typeof data === 'string' ? +new Date(data) : data;
|
|
2089
|
-
break;
|
|
2090
|
-
}
|
|
2091
|
-
case SqlType.char: {
|
|
2092
|
-
field[DBType.Mysql] = () => `${field.C2()} char(${config.length ?? 1}) ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2093
|
-
field[DBType.Postgresql] = () => `${field.C2()} char(${config.length ?? 1}) ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2094
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2095
|
-
break;
|
|
2096
|
-
}
|
|
2097
|
-
case SqlType.varchar: {
|
|
2098
|
-
field[DBType.Mysql] = () => `${field.C2()} varchar(${config.length ?? 1}) ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2099
|
-
field[DBType.Postgresql] = () => `${field.C2()} varchar(${config.length ?? 1}) ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2100
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2101
|
-
break;
|
|
2102
|
-
}
|
|
2103
|
-
case SqlType.tinyblob: {
|
|
2104
|
-
field[DBType.Mysql] = () => `${field.C2()} tinyblob ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2105
|
-
field[DBType.Postgresql] = () => `${field.C2()} bytea ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2106
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2107
|
-
break;
|
|
2108
|
-
}
|
|
2109
|
-
case SqlType.tinytext: {
|
|
2110
|
-
field[DBType.Mysql] = () => `${field.C2()} tinytext ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2111
|
-
field[DBType.Postgresql] = () => `${field.C2()} text ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2112
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2113
|
-
break;
|
|
2114
|
-
}
|
|
2115
|
-
case SqlType.blob: {
|
|
2116
|
-
field[DBType.Mysql] = () => `${field.C2()} binary ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2117
|
-
field[DBType.Postgresql] = () => `${field.C2()} bytea ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2118
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2119
|
-
break;
|
|
2120
|
-
}
|
|
2121
|
-
case SqlType.text: {
|
|
2122
|
-
field[DBType.Mysql] = () => `${field.C2()} text ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2123
|
-
field[DBType.Postgresql] = () => `${field.C2()} text ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2124
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2125
|
-
break;
|
|
2126
|
-
}
|
|
2127
|
-
case SqlType.mediumblob: {
|
|
2128
|
-
field[DBType.Mysql] = () => `${field.C2()} mediumblob ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2129
|
-
field[DBType.Postgresql] = () => `${field.C2()} bytea ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2130
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2131
|
-
break;
|
|
2132
|
-
}
|
|
2133
|
-
case SqlType.mediumtext: {
|
|
2134
|
-
field[DBType.Mysql] = () => `${field.C2()} mediumtext ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2135
|
-
field[DBType.Postgresql] = () => `${field.C2()} text ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2136
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2137
|
-
break;
|
|
2138
|
-
}
|
|
2139
|
-
case SqlType.longblob: {
|
|
2140
|
-
field[DBType.Mysql] = () => `${field.C2()} longblob ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2141
|
-
field[DBType.Postgresql] = () => `${field.C2()} bytea ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2142
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2143
|
-
break;
|
|
2144
|
-
}
|
|
2145
|
-
case SqlType.longtext: {
|
|
2146
|
-
field[DBType.Mysql] = () => `${field.C2()} longtext ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2147
|
-
field[DBType.Postgresql] = () => `${field.C2()} text ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2148
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2149
|
-
break;
|
|
2150
|
-
}
|
|
2151
|
-
case SqlType.json: {
|
|
2152
|
-
field[DBType.Mysql] = () => `${field.C2()} json ${config.notNull === true ? 'NOT NULL' : ''} ${MYSQLCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2153
|
-
field[DBType.Postgresql] = () => `${field.C2()} jsonb ${config.notNull === true ? 'NOT NULL' : ''} ${POSTGRESCHARSET} ${hasDef ? `DEFAULT '${field.def}'` : ''}`;
|
|
2154
|
-
field[DBType.SqliteRemote] = field[DBType.Sqlite] = () => `${field.C2()} text`;
|
|
2155
|
-
break;
|
|
2156
|
-
}
|
|
2157
|
-
}
|
|
2158
|
-
;
|
|
2159
|
-
let __fields = Reflect.getMetadata(_fields, object);
|
|
2160
|
-
let __columns = Reflect.getMetadata(_columns, object);
|
|
2161
|
-
let __columnsNoId = Reflect.getMetadata(_columnsNoId, object);
|
|
2162
|
-
let __ids = Reflect.getMetadata(_ids, object);
|
|
2163
|
-
let __logicIds = Reflect.getMetadata(_logicIds, object);
|
|
2164
|
-
let __index = Reflect.getMetadata(_index, object);
|
|
2165
|
-
let __def = Reflect.getMetadata(_def, object);
|
|
2166
|
-
if (!__fields) {
|
|
2167
|
-
__fields = {};
|
|
2168
|
-
__columns = [];
|
|
2169
|
-
__columnsNoId = [];
|
|
2170
|
-
__ids = [];
|
|
2171
|
-
__index = [];
|
|
2172
|
-
__def = {};
|
|
2173
|
-
}
|
|
2174
|
-
__fields[propertyName] = field;
|
|
2175
|
-
__columns.push(propertyName);
|
|
2176
|
-
if (field.id === true) {
|
|
2177
|
-
__ids.push(propertyName);
|
|
2178
|
-
}
|
|
2179
|
-
else {
|
|
2180
|
-
__columnsNoId.push(propertyName);
|
|
2181
|
-
}
|
|
2182
|
-
if (field.logicId === true) {
|
|
2183
|
-
__logicIds.push(propertyName);
|
|
2184
|
-
}
|
|
2185
|
-
if (field.index === true) {
|
|
2186
|
-
__index.push(propertyName);
|
|
2187
|
-
}
|
|
2188
|
-
if (hasDef) {
|
|
2189
|
-
__def[propertyName] = field.def;
|
|
2190
|
-
}
|
|
2191
|
-
Reflect.defineMetadata(_fields, __fields, object);
|
|
2192
|
-
Reflect.defineMetadata(_columns, __columns, object);
|
|
2193
|
-
Reflect.defineMetadata(_columnsNoId, __columnsNoId, object);
|
|
2194
|
-
Reflect.defineMetadata(_ids, __ids, object);
|
|
2195
|
-
Reflect.defineMetadata(_logicIds, __logicIds, object);
|
|
2196
|
-
Reflect.defineMetadata(_index, __index, object);
|
|
2197
|
-
Reflect.defineMetadata(_def, __def, object);
|
|
2198
|
-
if (field.hasOwnProperty('logicDelete')) {
|
|
2199
|
-
Reflect.defineMetadata(_deleteState, field.logicDelete, object);
|
|
2200
|
-
Reflect.defineMetadata(_stateFileName, propertyName, object);
|
|
2201
|
-
}
|
|
2202
|
-
};
|
|
2203
|
-
};
|
|
2204
1930
|
const formatDialects = {
|
|
2205
1931
|
[DBType.Mysql]: mysql,
|
|
2206
1932
|
[DBType.Sqlite]: sqlite,
|
|
@@ -3677,6 +3403,7 @@ class StreamQuery {
|
|
|
3677
3403
|
this.if_proceed = condition;
|
|
3678
3404
|
return this;
|
|
3679
3405
|
}
|
|
3406
|
+
eqs(keys, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this.__(keys, value, '=', { paramName, skipEmptyString, breakExcuteIfSkip }); }
|
|
3680
3407
|
eq(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) { return this._(key, value, '=', { paramName, skipEmptyString, breakExcuteIfSkip }); }
|
|
3681
3408
|
eqT(t, { name: paramName = '', breakExcuteIfSkip = false } = {}) {
|
|
3682
3409
|
let exe = false;
|
|
@@ -4052,7 +3779,6 @@ class StreamQuery {
|
|
|
4052
3779
|
this._param[this._paramKeys[paramName]] = value;
|
|
4053
3780
|
}
|
|
4054
3781
|
else {
|
|
4055
|
-
paramName;
|
|
4056
3782
|
const pkey = `p${this._prefix}${this._index++}`;
|
|
4057
3783
|
this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} ${not} ${op} :${pkey} `);
|
|
4058
3784
|
this._param[pkey] = value;
|
|
@@ -4062,6 +3788,28 @@ class StreamQuery {
|
|
|
4062
3788
|
}
|
|
4063
3789
|
return this;
|
|
4064
3790
|
}
|
|
3791
|
+
__(keys, value, op, { not = '', paramName = '', skipEmptyString = true, breakExcuteIfSkip = false } = {}) {
|
|
3792
|
+
if (value === null
|
|
3793
|
+
|| value === undefined
|
|
3794
|
+
|| (emptyString(`${value ?? ''}`) && skipEmptyString === true)) {
|
|
3795
|
+
if (breakExcuteIfSkip === true) {
|
|
3796
|
+
this.if_exec = false;
|
|
3797
|
+
}
|
|
3798
|
+
return this;
|
|
3799
|
+
}
|
|
3800
|
+
if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
|
|
3801
|
+
this._param[this._paramKeys[paramName]] = value;
|
|
3802
|
+
}
|
|
3803
|
+
else {
|
|
3804
|
+
const pkey = `p${this._prefix}${this._index++}`;
|
|
3805
|
+
this._wheres.push(`AND (${keys.map(key => `${this[_fields][String(key)]?.C2()} ${not} ${op} :${pkey} `).join(' OR ')})`);
|
|
3806
|
+
this._param[pkey] = value;
|
|
3807
|
+
if (paramName) {
|
|
3808
|
+
this._paramKeys[paramName] = pkey;
|
|
3809
|
+
}
|
|
3810
|
+
}
|
|
3811
|
+
return this;
|
|
3812
|
+
}
|
|
4065
3813
|
_null(key, not = '') {
|
|
4066
3814
|
this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} IS ${not} NULL`);
|
|
4067
3815
|
return this;
|
|
@@ -4233,6 +3981,12 @@ __decorate([
|
|
|
4233
3981
|
__metadata("design:paramtypes", [Boolean]),
|
|
4234
3982
|
__metadata("design:returntype", void 0)
|
|
4235
3983
|
], StreamQuery.prototype, "if", null);
|
|
3984
|
+
__decorate([
|
|
3985
|
+
IF_PROCEED(),
|
|
3986
|
+
__metadata("design:type", Function),
|
|
3987
|
+
__metadata("design:paramtypes", [Array, Object, Object]),
|
|
3988
|
+
__metadata("design:returntype", void 0)
|
|
3989
|
+
], StreamQuery.prototype, "eqs", null);
|
|
4236
3990
|
__decorate([
|
|
4237
3991
|
IF_PROCEED(),
|
|
4238
3992
|
__metadata("design:type", Function),
|
package/test-mysql.js
CHANGED
|
@@ -7,9 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
+
import { Field, SqlType } from 'baja-lite-field';
|
|
10
11
|
import 'reflect-metadata';
|
|
11
12
|
import { Boot } from './boot.js';
|
|
12
|
-
import { ColumnMode, DB,
|
|
13
|
+
import { ColumnMode, DB, SqlService } from './sql.js';
|
|
13
14
|
class BaseAuditUser {
|
|
14
15
|
}
|
|
15
16
|
__decorate([
|
package/test-postgresql.js
CHANGED
|
@@ -7,9 +7,10 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
|
7
7
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
8
8
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
9
9
|
};
|
|
10
|
+
import { DBType, Field, SqlType } from 'baja-lite-field';
|
|
10
11
|
import 'reflect-metadata';
|
|
11
12
|
import { Boot } from './boot.js';
|
|
12
|
-
import {
|
|
13
|
+
import { ColumnMode, DB, SelectResult, SqlService, } from './sql.js';
|
|
13
14
|
class AmaFuck2 {
|
|
14
15
|
}
|
|
15
16
|
__decorate([
|