baja-lite 1.0.7 → 1.0.16
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/cjs/boot-remote.js +4 -0
- package/cjs/boot.js +4 -0
- package/cjs/code.js +27 -12
- package/cjs/convert-xml.js +5 -1
- package/cjs/enum.d.ts +8 -0
- package/cjs/enum.js +33 -1
- package/cjs/fn.js +45 -35
- package/cjs/list.js +24 -0
- package/cjs/math.d.ts +14 -0
- package/cjs/math.js +39 -0
- package/cjs/set-ex.d.ts +8 -7
- package/cjs/set-ex.js +51 -58
- package/cjs/sql.d.ts +91 -34
- package/cjs/sql.js +382 -227
- package/cjs/sqlite.d.ts +5 -8
- package/cjs/sqlite.js +25 -22
- package/cjs/test-mysql.js +29 -21
- package/es/boot-remote.js +5 -1
- package/es/boot.js +5 -1
- package/es/code.js +27 -12
- package/es/convert-xml.js +2 -1
- package/es/enum.d.ts +8 -0
- package/es/enum.js +31 -0
- package/es/fn.js +45 -35
- package/es/list.js +24 -0
- package/es/math.d.ts +14 -0
- package/es/math.js +37 -0
- package/es/set-ex.d.ts +8 -7
- package/es/set-ex.js +48 -58
- package/es/sql.d.ts +91 -34
- package/es/sql.js +383 -228
- package/es/sqlite.d.ts +5 -8
- package/es/sqlite.js +26 -23
- package/es/test-mysql.js +30 -22
- package/package.json +70 -70
- package/src/boot-remote.ts +5 -1
- package/src/boot.ts +5 -1
- package/src/code.ts +45 -14
- package/src/convert-xml.ts +2 -2
- package/src/enum.ts +43 -3
- package/src/fn.ts +41 -33
- package/src/list.ts +27 -1
- package/src/math.ts +41 -3
- package/src/set-ex.ts +49 -58
- package/src/sql.ts +391 -217
- package/src/sqlite.ts +26 -20
- package/src/test-mysql.ts +30 -28
package/es/set-ex.d.ts
CHANGED
|
@@ -6,6 +6,7 @@ export declare class SetEx<T> extends Set {
|
|
|
6
6
|
private _onExist2?;
|
|
7
7
|
private _onNotExist2?;
|
|
8
8
|
private _replaceIfExits2;
|
|
9
|
+
private _map;
|
|
9
10
|
/**
|
|
10
11
|
* @param key 识别是否存在的对象的属性名
|
|
11
12
|
* @param onExist 当存在时作何操作? oldData/newData 哪个将添加到set,由replaceItemWhenExits决定,默认是oldData生效
|
|
@@ -58,16 +59,16 @@ export declare class SetEx<T> extends Set {
|
|
|
58
59
|
addAll2(values: T[]): T[];
|
|
59
60
|
/**
|
|
60
61
|
* 用key找到匹配的第一个对象
|
|
61
|
-
* @param {*}
|
|
62
|
+
* @param {*} key 这是对象的关键属性,而非对象
|
|
62
63
|
* @returns {(T | null)}
|
|
63
64
|
*/
|
|
64
|
-
find(
|
|
65
|
+
find(key: T[keyof T]): T | null;
|
|
65
66
|
/**
|
|
66
67
|
* 用key找到匹配的所有对象
|
|
67
|
-
* @param {*}
|
|
68
|
+
* @param {*} key 这是对象的关键属性,而非对象
|
|
68
69
|
* @returns {T[]}
|
|
69
70
|
*/
|
|
70
|
-
findAll(
|
|
71
|
+
findAll(key: T[keyof T]): T[];
|
|
71
72
|
/**
|
|
72
73
|
*
|
|
73
74
|
* 用函数回调找到匹配的第一个对象
|
|
@@ -88,7 +89,7 @@ export declare class SetEx<T> extends Set {
|
|
|
88
89
|
* @param {*} value 这是对象的关键属性,而非对象
|
|
89
90
|
* @returns {boolean}
|
|
90
91
|
*/
|
|
91
|
-
has(
|
|
92
|
+
has(key: T[keyof T]): boolean;
|
|
92
93
|
/**
|
|
93
94
|
* 转为数组
|
|
94
95
|
* @param param0
|
|
@@ -118,10 +119,10 @@ export declare class SetEx<T> extends Set {
|
|
|
118
119
|
/**
|
|
119
120
|
*
|
|
120
121
|
* 删除key对应的对象
|
|
121
|
-
* @param {*}
|
|
122
|
+
* @param {*} _key 这是对象的关键属性,而非对象
|
|
122
123
|
* @returns {boolean}
|
|
123
124
|
*/
|
|
124
|
-
delete(
|
|
125
|
+
delete(_key: T[keyof T]): boolean;
|
|
125
126
|
/**
|
|
126
127
|
*
|
|
127
128
|
* 重置
|
package/es/set-ex.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import iterate from "iterare";
|
|
1
2
|
export class SetEx extends Set {
|
|
2
3
|
/**
|
|
3
4
|
* @param key 识别是否存在的对象的属性名
|
|
@@ -8,6 +9,7 @@ export class SetEx extends Set {
|
|
|
8
9
|
*/
|
|
9
10
|
constructor(option) {
|
|
10
11
|
super();
|
|
12
|
+
this._map = new Map();
|
|
11
13
|
this._key = option.key;
|
|
12
14
|
this._onExist1 = option.onExist1;
|
|
13
15
|
this._onNotExist1 = option.onNotExist1;
|
|
@@ -27,21 +29,22 @@ export class SetEx extends Set {
|
|
|
27
29
|
*/
|
|
28
30
|
add(value) {
|
|
29
31
|
let flag = false;
|
|
30
|
-
this.
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
if (this._replaceIfExits1 === true) {
|
|
37
|
-
super.delete(item);
|
|
38
|
-
flag = false;
|
|
39
|
-
}
|
|
40
|
-
return false;
|
|
32
|
+
const key = value[this._key];
|
|
33
|
+
const item = this._map.get(key);
|
|
34
|
+
if (item) {
|
|
35
|
+
flag = true;
|
|
36
|
+
if (this._onExist1) {
|
|
37
|
+
this._onExist1(item, value);
|
|
41
38
|
}
|
|
42
|
-
|
|
39
|
+
if (this._replaceIfExits1 === true) {
|
|
40
|
+
super.delete(item);
|
|
41
|
+
this._map.delete(key);
|
|
42
|
+
flag = false;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
43
45
|
if (flag === false) {
|
|
44
46
|
super.add(value);
|
|
47
|
+
this._map.set(key, value);
|
|
45
48
|
if (this._onNotExist1) {
|
|
46
49
|
this._onNotExist1(value);
|
|
47
50
|
}
|
|
@@ -67,25 +70,26 @@ export class SetEx extends Set {
|
|
|
67
70
|
*/
|
|
68
71
|
add2(value) {
|
|
69
72
|
let flag = false;
|
|
73
|
+
const key = value[this._key];
|
|
74
|
+
const item = this._map.get(key);
|
|
70
75
|
let tmp = value;
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
this._onExist2(item, value);
|
|
76
|
-
}
|
|
77
|
-
if (this._replaceIfExits2 === true) {
|
|
78
|
-
super.delete(value);
|
|
79
|
-
flag = false;
|
|
80
|
-
}
|
|
81
|
-
else {
|
|
82
|
-
tmp = item;
|
|
83
|
-
}
|
|
84
|
-
return false;
|
|
76
|
+
if (item) {
|
|
77
|
+
flag = true;
|
|
78
|
+
if (this._onExist2) {
|
|
79
|
+
this._onExist2(item, value);
|
|
85
80
|
}
|
|
86
|
-
|
|
81
|
+
if (this._replaceIfExits2 === true) {
|
|
82
|
+
super.delete(value);
|
|
83
|
+
this._map.delete(key);
|
|
84
|
+
flag = false;
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
tmp = item;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
87
90
|
if (flag === false) {
|
|
88
91
|
super.add(value);
|
|
92
|
+
this._map.set(key, value);
|
|
89
93
|
if (this._onNotExist2) {
|
|
90
94
|
this._onNotExist2(value);
|
|
91
95
|
}
|
|
@@ -107,30 +111,19 @@ export class SetEx extends Set {
|
|
|
107
111
|
}
|
|
108
112
|
/**
|
|
109
113
|
* 用key找到匹配的第一个对象
|
|
110
|
-
* @param {*}
|
|
114
|
+
* @param {*} key 这是对象的关键属性,而非对象
|
|
111
115
|
* @returns {(T | null)}
|
|
112
116
|
*/
|
|
113
|
-
find(
|
|
114
|
-
|
|
115
|
-
if (item[this._key] === value) {
|
|
116
|
-
return item;
|
|
117
|
-
}
|
|
118
|
-
}
|
|
119
|
-
return null;
|
|
117
|
+
find(key) {
|
|
118
|
+
return this._map.get(key) ?? null;
|
|
120
119
|
}
|
|
121
120
|
/**
|
|
122
121
|
* 用key找到匹配的所有对象
|
|
123
|
-
* @param {*}
|
|
122
|
+
* @param {*} key 这是对象的关键属性,而非对象
|
|
124
123
|
* @returns {T[]}
|
|
125
124
|
*/
|
|
126
|
-
findAll(
|
|
127
|
-
|
|
128
|
-
this.forEach((item) => {
|
|
129
|
-
if (item[this._key] === value) {
|
|
130
|
-
res.push(item);
|
|
131
|
-
}
|
|
132
|
-
});
|
|
133
|
-
return res;
|
|
125
|
+
findAll(key) {
|
|
126
|
+
return iterate(key).map(k => this._map.get(k)).filter(v => v !== undefined).toArray();
|
|
134
127
|
}
|
|
135
128
|
/**
|
|
136
129
|
*
|
|
@@ -167,13 +160,8 @@ export class SetEx extends Set {
|
|
|
167
160
|
* @param {*} value 这是对象的关键属性,而非对象
|
|
168
161
|
* @returns {boolean}
|
|
169
162
|
*/
|
|
170
|
-
has(
|
|
171
|
-
|
|
172
|
-
if (item[this._key] === value) {
|
|
173
|
-
return true;
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
return false;
|
|
163
|
+
has(key) {
|
|
164
|
+
return this._map.has(key);
|
|
177
165
|
}
|
|
178
166
|
/**
|
|
179
167
|
* 转为数组
|
|
@@ -209,15 +197,16 @@ export class SetEx extends Set {
|
|
|
209
197
|
/**
|
|
210
198
|
*
|
|
211
199
|
* 删除key对应的对象
|
|
212
|
-
* @param {*}
|
|
200
|
+
* @param {*} _key 这是对象的关键属性,而非对象
|
|
213
201
|
* @returns {boolean}
|
|
214
202
|
*/
|
|
215
|
-
delete(
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
203
|
+
delete(_key) {
|
|
204
|
+
const key = _key;
|
|
205
|
+
const item = this._map.get(key);
|
|
206
|
+
if (item) {
|
|
207
|
+
super.delete(item);
|
|
208
|
+
this._map.delete(key);
|
|
209
|
+
return true;
|
|
221
210
|
}
|
|
222
211
|
return false;
|
|
223
212
|
}
|
|
@@ -230,6 +219,7 @@ export class SetEx extends Set {
|
|
|
230
219
|
*/
|
|
231
220
|
reset(option) {
|
|
232
221
|
this.clear();
|
|
222
|
+
this._map.clear();
|
|
233
223
|
if (option.key) {
|
|
234
224
|
this._key = option.key;
|
|
235
225
|
}
|
package/es/sql.d.ts
CHANGED
|
@@ -1,11 +1,15 @@
|
|
|
1
1
|
import { XML } from './convert-xml';
|
|
2
2
|
import { ArrayList } from './list';
|
|
3
|
+
import { EnumMap } from 'enum';
|
|
4
|
+
import { ExtensionCodec } from "@msgpack/msgpack";
|
|
5
|
+
export declare const extensionCodec: ExtensionCodec<undefined>;
|
|
3
6
|
declare const _daoDBName: unique symbol;
|
|
4
7
|
declare const _tableName: unique symbol;
|
|
5
8
|
declare const _className: unique symbol;
|
|
6
9
|
declare const _ClassName: unique symbol;
|
|
7
10
|
declare const _vueName: unique symbol;
|
|
8
11
|
declare const _ids: unique symbol;
|
|
12
|
+
declare const _logicIds: unique symbol;
|
|
9
13
|
declare const _columns: unique symbol;
|
|
10
14
|
declare const _columnsNoId: unique symbol;
|
|
11
15
|
declare const _fields: unique symbol;
|
|
@@ -14,16 +18,19 @@ declare const _deleteState: unique symbol;
|
|
|
14
18
|
declare const _transformer: unique symbol;
|
|
15
19
|
declare const _index: unique symbol;
|
|
16
20
|
declare const _def: unique symbol;
|
|
21
|
+
declare const _comment: unique symbol;
|
|
17
22
|
export declare const _sqlCache: unique symbol;
|
|
18
23
|
export declare const _dao: unique symbol;
|
|
19
24
|
export declare const _primaryDB: unique symbol;
|
|
20
25
|
declare const _dbType: unique symbol;
|
|
26
|
+
declare const _formatDialect: unique symbol;
|
|
21
27
|
declare const _sqlite_version: unique symbol;
|
|
22
28
|
declare const _daoConnection: unique symbol;
|
|
23
29
|
declare const _inTransaction: unique symbol;
|
|
24
30
|
declare const _daoDB: unique symbol;
|
|
25
31
|
declare const _sqliteRemoteName: unique symbol;
|
|
26
32
|
declare const _SqlOption: unique symbol;
|
|
33
|
+
export declare const _enums: unique symbol;
|
|
27
34
|
export declare const _Hump: unique symbol;
|
|
28
35
|
export declare const _GlobalSqlOption: unique symbol;
|
|
29
36
|
export declare const _EventBus: unique symbol;
|
|
@@ -213,6 +220,8 @@ interface ServiceOption {
|
|
|
213
220
|
dbType?: DBType;
|
|
214
221
|
/** SQLite版本以及升级为该版本时需要执行的SQL,初始版本为0.0.1,切记每个位置不要变为两位数*/
|
|
215
222
|
sqliteVersion?: string;
|
|
223
|
+
/** 备注 */
|
|
224
|
+
comment?: string;
|
|
216
225
|
}
|
|
217
226
|
/**
|
|
218
227
|
# 全局行为配置文件
|
|
@@ -274,6 +283,23 @@ export interface GlobalSqlOptionForWeb {
|
|
|
274
283
|
]
|
|
275
284
|
*/
|
|
276
285
|
sqlMapperMap?: SqlMappers;
|
|
286
|
+
/** 提供的枚举MAP */
|
|
287
|
+
enums?: EnumMap;
|
|
288
|
+
/**
|
|
289
|
+
* `列名与属性映射` 是否自动将下划线转为驼峰,默认NONE,即不转.
|
|
290
|
+
* 当设置为columnMode.HUMP时,切记将代码生成器中属性名称改对
|
|
291
|
+
* # 自定义sql查询时,无法自动转换哦,可使用标签转换:
|
|
292
|
+
*```
|
|
293
|
+
SELECT
|
|
294
|
+
* {{#hump}} seller_sku2, seller_sku {{/hump}}
|
|
295
|
+
* ```
|
|
296
|
+
* 转换为
|
|
297
|
+
*```
|
|
298
|
+
SELECT
|
|
299
|
+
* {{#hump}} seller_sku2 sellerSku2, seller_sku sellerSku {{/hump}}
|
|
300
|
+
* ```
|
|
301
|
+
*/
|
|
302
|
+
columnMode?: ColumnMode;
|
|
277
303
|
}
|
|
278
304
|
/**
|
|
279
305
|
# 全局行为配置文件
|
|
@@ -335,12 +361,13 @@ export interface GlobalSqlOption extends GlobalSqlOptionForWeb {
|
|
|
335
361
|
export default {
|
|
336
362
|
'sql_1': 'SELECT * FROM user WHERE username = :username',
|
|
337
363
|
'sql_2': (options: {
|
|
338
|
-
ctx
|
|
364
|
+
ctx?: any;
|
|
339
365
|
isCount?: boolean;
|
|
366
|
+
isSum?: boolean;
|
|
340
367
|
limitStart?: number;
|
|
341
368
|
limitEnd?: number;
|
|
342
369
|
orderBy?: string;
|
|
343
|
-
|
|
370
|
+
params?: Record<string, any>;
|
|
344
371
|
}) => {
|
|
345
372
|
return `
|
|
346
373
|
SELECT * FROM user u LEFT JOIN organ o ON u.orgid = o.orgid
|
|
@@ -405,21 +432,6 @@ export interface GlobalSqlOption extends GlobalSqlOptionForWeb {
|
|
|
405
432
|
```
|
|
406
433
|
*/
|
|
407
434
|
Redis?: Record<string, Record<string, any>> | Record<string, any>;
|
|
408
|
-
/**
|
|
409
|
-
* `列名与属性映射` 是否自动将下划线转为驼峰,默认NONE,即不转.
|
|
410
|
-
* 当设置为columnMode.HUMP时,切记将代码生成器中属性名称改对
|
|
411
|
-
* # 自定义sql查询时,无法自动转换哦,可使用标签转换:
|
|
412
|
-
*```
|
|
413
|
-
SELECT
|
|
414
|
-
* {{#hump}} seller_sku2, seller_sku {{/hump}}
|
|
415
|
-
* ```
|
|
416
|
-
* 转换为
|
|
417
|
-
*```
|
|
418
|
-
SELECT
|
|
419
|
-
* {{#hump}} seller_sku2 sellerSku2, seller_sku sellerSku {{/hump}}
|
|
420
|
-
* ```
|
|
421
|
-
*/
|
|
422
|
-
columnMode?: ColumnMode;
|
|
423
435
|
/**
|
|
424
436
|
* 读取查询语句时,是否扫描JS文件?
|
|
425
437
|
* JS文件需要默认导出一个 SqlModel对象
|
|
@@ -436,9 +448,16 @@ interface FieldOption extends Object {
|
|
|
436
448
|
index?: boolean;
|
|
437
449
|
id?: boolean;
|
|
438
450
|
logicDelete?: string | number;
|
|
451
|
+
/** 是否逻辑唯一,用于导入时检测数据是否存在 */
|
|
452
|
+
logicId?: boolean;
|
|
439
453
|
/** 仅在生成 表时有效 */
|
|
440
454
|
notNull?: boolean;
|
|
455
|
+
/** 注释,影响到默认导出导入标题 */
|
|
441
456
|
comment?: string;
|
|
457
|
+
/** 可以导入的字段,默认TRUE,ID默认FALSE */
|
|
458
|
+
importable?: boolean;
|
|
459
|
+
/** 可以导出的字段,默认TRUE,ID默认FALSE */
|
|
460
|
+
exportable?: boolean;
|
|
442
461
|
/** sqlite 无效,与UUID只能有一个 */
|
|
443
462
|
uuidShort?: boolean;
|
|
444
463
|
/** 与uuidShort只能有一个 */
|
|
@@ -454,6 +473,7 @@ interface AField extends FieldOption {
|
|
|
454
473
|
[DBType.Mysql]: () => string;
|
|
455
474
|
[DBType.Sqlite]: () => string;
|
|
456
475
|
[DBType.SqliteRemote]: () => string;
|
|
476
|
+
Data2SQL: (data: any) => any;
|
|
457
477
|
}
|
|
458
478
|
export interface PageQuery<L> {
|
|
459
479
|
sum?: Record<string, number>;
|
|
@@ -463,14 +483,11 @@ export interface PageQuery<L> {
|
|
|
463
483
|
}
|
|
464
484
|
/** sqlite electron服务端需要支持的接口 */
|
|
465
485
|
export interface SqliteRemoteInterface {
|
|
466
|
-
execute(
|
|
467
|
-
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
get<One_Row_Many_Column = any>(dbName: string, sql?: string, params?: any): Promise<One_Row_Many_Column | null>;
|
|
472
|
-
raw<Many_Row_One_Column = any>(dbName: string, sql?: string, params?: any): Promise<Many_Row_One_Column[]>;
|
|
473
|
-
query<Many_Row_Many_Column = any>(dbName: string, sql?: string, params?: any): Promise<Many_Row_Many_Column[]>;
|
|
486
|
+
execute(inData: Uint8Array): Promise<Uint8Array>;
|
|
487
|
+
pluck(inData: Uint8Array): Promise<Uint8Array>;
|
|
488
|
+
get(inData: Uint8Array): Promise<Uint8Array>;
|
|
489
|
+
raw(inData: Uint8Array): Promise<Uint8Array>;
|
|
490
|
+
query(inData: Uint8Array): Promise<Uint8Array>;
|
|
474
491
|
initDB(dbName: string): Promise<void>;
|
|
475
492
|
export(dbName: string): Promise<void>;
|
|
476
493
|
restore(dbName: string, fromName: string): Promise<void>;
|
|
@@ -575,6 +592,7 @@ export declare class SqliteRemoteConnection implements Connection {
|
|
|
575
592
|
export declare class SqliteRemote implements Dao {
|
|
576
593
|
[_sqliteRemoteName]: string;
|
|
577
594
|
[_daoDB]: SqliteRemoteInterface;
|
|
595
|
+
private connection?;
|
|
578
596
|
constructor(db: SqliteRemoteInterface, name: string);
|
|
579
597
|
createConnection(sync: SyncMode.Sync): Connection | null;
|
|
580
598
|
createConnection(sync: SyncMode.Async): Promise<Connection | null>;
|
|
@@ -592,22 +610,22 @@ export declare class SqliteRemote implements Dao {
|
|
|
592
610
|
export type SqlMapper = ([string, string[], any?])[];
|
|
593
611
|
export type SqlMappers = Record<string, SqlMapper>;
|
|
594
612
|
export type SqlModel = Record<string, string | ((options: {
|
|
595
|
-
ctx
|
|
613
|
+
ctx?: any;
|
|
596
614
|
isCount?: boolean;
|
|
597
615
|
isSum?: boolean;
|
|
598
616
|
limitStart?: number;
|
|
599
617
|
limitEnd?: number;
|
|
600
618
|
orderBy?: string;
|
|
601
|
-
|
|
619
|
+
params?: any;
|
|
602
620
|
}) => string)>;
|
|
603
621
|
type _SqlModel = Record<string, string | ((options: {
|
|
604
|
-
ctx
|
|
622
|
+
ctx?: any;
|
|
605
623
|
isCount?: boolean;
|
|
606
624
|
isSum?: boolean;
|
|
607
625
|
limitStart?: number;
|
|
608
626
|
limitEnd?: number;
|
|
609
627
|
orderBy?: string;
|
|
610
|
-
|
|
628
|
+
params?: any;
|
|
611
629
|
}) => string) | XML[]>;
|
|
612
630
|
/**
|
|
613
631
|
* ifUndefined默认是MapperIfUndefined.Skip
|
|
@@ -644,7 +662,7 @@ export declare class SqlCache {
|
|
|
644
662
|
jsMode?: boolean;
|
|
645
663
|
}): Promise<void>;
|
|
646
664
|
load(sqlids: string[], options: {
|
|
647
|
-
ctx
|
|
665
|
+
ctx?: any;
|
|
648
666
|
isCount?: boolean;
|
|
649
667
|
isSum?: boolean;
|
|
650
668
|
limitStart?: number;
|
|
@@ -664,6 +682,7 @@ export declare const DB: (config: ServiceOption) => <C extends {
|
|
|
664
682
|
[_vueName]: string | undefined;
|
|
665
683
|
[_daoDBName]: string | undefined;
|
|
666
684
|
[_dbType]: DBType;
|
|
685
|
+
[_formatDialect]: any;
|
|
667
686
|
[_sqlite_version]: string | undefined;
|
|
668
687
|
[_SqlOption]: {
|
|
669
688
|
maxDeal: number;
|
|
@@ -672,11 +691,13 @@ export declare const DB: (config: ServiceOption) => <C extends {
|
|
|
672
691
|
skipEmptyString: boolean;
|
|
673
692
|
} & ServiceOption;
|
|
674
693
|
[_ids]: any;
|
|
694
|
+
[_logicIds]: any;
|
|
675
695
|
[_fields]: any;
|
|
676
696
|
[_columns]: any;
|
|
677
697
|
[_columnsNoId]: any;
|
|
678
698
|
[_index]: any;
|
|
679
699
|
[_def]: any;
|
|
700
|
+
[_comment]: string | undefined;
|
|
680
701
|
[_stateFileName]: any;
|
|
681
702
|
[_deleteState]: any;
|
|
682
703
|
[_transformer]: <L extends Object>(data: L, option?: MethodOption & {
|
|
@@ -733,6 +754,7 @@ export declare class SqlService<T extends object> {
|
|
|
733
754
|
private [_ClassName]?;
|
|
734
755
|
private [_vueName]?;
|
|
735
756
|
private [_daoDBName]?;
|
|
757
|
+
private [_comment]?;
|
|
736
758
|
private [_ids]?;
|
|
737
759
|
private [_fields]?;
|
|
738
760
|
private [_columns]?;
|
|
@@ -741,6 +763,7 @@ export declare class SqlService<T extends object> {
|
|
|
741
763
|
private [_deleteState]?;
|
|
742
764
|
private [_SqlOption]?;
|
|
743
765
|
private [_dbType]?;
|
|
766
|
+
private [_formatDialect]?;
|
|
744
767
|
private [_sqlite_version]?;
|
|
745
768
|
private [_index]?;
|
|
746
769
|
private [_def]?;
|
|
@@ -1246,8 +1269,8 @@ export declare class SqlService<T extends object> {
|
|
|
1246
1269
|
sqlId: string;
|
|
1247
1270
|
context?: any;
|
|
1248
1271
|
params: Record<string, any>;
|
|
1249
|
-
pageSize
|
|
1250
|
-
pageNumber
|
|
1272
|
+
pageSize?: number;
|
|
1273
|
+
pageNumber?: number;
|
|
1251
1274
|
limitSelf?: boolean;
|
|
1252
1275
|
countSelf?: boolean;
|
|
1253
1276
|
sumSelf?: boolean;
|
|
@@ -1261,8 +1284,8 @@ export declare class SqlService<T extends object> {
|
|
|
1261
1284
|
sqlId: string;
|
|
1262
1285
|
context?: any;
|
|
1263
1286
|
params: Record<string, any>;
|
|
1264
|
-
pageSize
|
|
1265
|
-
pageNumber
|
|
1287
|
+
pageSize?: number;
|
|
1288
|
+
pageNumber?: number;
|
|
1266
1289
|
limitSelf?: boolean;
|
|
1267
1290
|
countSelf?: boolean;
|
|
1268
1291
|
sumSelf?: boolean;
|
|
@@ -1271,6 +1294,40 @@ export declare class SqlService<T extends object> {
|
|
|
1271
1294
|
mapper?: string | SqlMapper;
|
|
1272
1295
|
mapperIfUndefined?: MapperIfUndefined;
|
|
1273
1296
|
}): PageQuery<L>;
|
|
1297
|
+
/**
|
|
1298
|
+
* 导出数据,可以为EJS-EXCEL直接使用
|
|
1299
|
+
* @param list
|
|
1300
|
+
* @returns
|
|
1301
|
+
*/
|
|
1302
|
+
exp<L = T>(list: L[]): {
|
|
1303
|
+
title: string | undefined;
|
|
1304
|
+
titleSpan: string;
|
|
1305
|
+
columnTitles: string[];
|
|
1306
|
+
datas: any[][];
|
|
1307
|
+
};
|
|
1308
|
+
/**
|
|
1309
|
+
* 导入数据的模板
|
|
1310
|
+
* @returns
|
|
1311
|
+
*/
|
|
1312
|
+
imp(): {
|
|
1313
|
+
title: string | undefined;
|
|
1314
|
+
titleSpan: string;
|
|
1315
|
+
columnTitles: string[];
|
|
1316
|
+
};
|
|
1317
|
+
/**
|
|
1318
|
+
* 初始化表结构
|
|
1319
|
+
* 只有sqlite、sqliteremote需要
|
|
1320
|
+
* force: 是否强制,默认false, 强制时会删除再创建
|
|
1321
|
+
* @param option
|
|
1322
|
+
*/
|
|
1323
|
+
init(option?: MethodOption & {
|
|
1324
|
+
sync?: SyncMode.Async;
|
|
1325
|
+
force?: boolean;
|
|
1326
|
+
}): Promise<void>;
|
|
1327
|
+
init(option: MethodOption & {
|
|
1328
|
+
sync: SyncMode.Sync;
|
|
1329
|
+
force?: boolean;
|
|
1330
|
+
}): void;
|
|
1274
1331
|
/**
|
|
1275
1332
|
#创建表
|
|
1276
1333
|
** `tableName` 表名称
|