baja-lite 1.0.5 → 1.0.6
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.d.ts +2 -2
- package/cjs/code.js +19 -5
- package/cjs/convert-xml.js +3 -2
- package/cjs/fn.js +3 -3
- package/cjs/index.d.ts +1 -0
- package/cjs/index.js +1 -0
- package/cjs/list.d.ts +10 -0
- package/cjs/list.js +36 -0
- package/cjs/object.js +4 -4
- package/cjs/set-ex.d.ts +41 -15
- package/cjs/set-ex.js +68 -52
- package/cjs/sql.d.ts +391 -193
- package/cjs/sql.js +580 -287
- package/cjs/test-mysql.d.ts +1 -0
- package/cjs/test-mysql.js +15 -2
- package/es/boot-remote.d.ts +2 -2
- package/es/code.js +19 -5
- package/es/convert-xml.js +3 -2
- package/es/index.d.ts +1 -0
- package/es/index.js +1 -0
- package/es/list.d.ts +10 -0
- package/es/list.js +32 -0
- package/es/object.js +1 -1
- package/es/set-ex.d.ts +41 -15
- package/es/set-ex.js +68 -52
- package/es/sql.d.ts +391 -193
- package/es/sql.js +569 -277
- package/es/test-mysql.d.ts +1 -0
- package/es/test-mysql.js +15 -3
- package/package.json +8 -6
- package/src/boot-remote.ts +2 -2
- package/src/code.ts +24 -8
- package/src/convert-xml.ts +3 -2
- package/src/index.ts +2 -1
- package/src/list.ts +31 -0
- package/src/object.ts +3 -2
- package/src/set-ex.ts +91 -70
- package/src/sql.ts +647 -318
- package/src/test-mysql.ts +28 -9
package/cjs/sql.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { XML } from './convert-xml';
|
|
2
|
+
import { ArrayList } from './list';
|
|
2
3
|
declare const _daoDBName: unique symbol;
|
|
3
4
|
declare const _tableName: unique symbol;
|
|
4
5
|
declare const _className: unique symbol;
|
|
@@ -37,6 +38,12 @@ export declare enum DBType {
|
|
|
37
38
|
Redis = 4,
|
|
38
39
|
RedisLock = 5
|
|
39
40
|
}
|
|
41
|
+
export declare enum MapperIfUndefined {
|
|
42
|
+
Null = 0,
|
|
43
|
+
Skip = 1,
|
|
44
|
+
Zero = 2,
|
|
45
|
+
EmptyString = 3
|
|
46
|
+
}
|
|
40
47
|
export declare enum SyncMode {
|
|
41
48
|
/** 同步执行 */
|
|
42
49
|
Sync = 0,
|
|
@@ -98,16 +105,28 @@ export declare enum TemplateResult {
|
|
|
98
105
|
NotSureOne = 1,
|
|
99
106
|
/** 返回多条记录 */
|
|
100
107
|
Many = 2,
|
|
108
|
+
/** 返回多条记录并封装ArrayList */
|
|
109
|
+
ManyList = 3,
|
|
101
110
|
/** 仅查询记录数量 */
|
|
102
|
-
Count =
|
|
111
|
+
Count = 4
|
|
103
112
|
}
|
|
104
113
|
export declare enum SelectResult {
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
114
|
+
/** 一行一列 确定非空 */
|
|
115
|
+
R_C_Assert = 0,
|
|
116
|
+
/** 一行一列 可能空 */
|
|
117
|
+
R_C_NotSure = 1,
|
|
118
|
+
/** 一行多列 确定非空 */
|
|
119
|
+
R_CS_Assert = 2,
|
|
120
|
+
/** 一行多列 可能空 */
|
|
121
|
+
R_CS_NotSure = 3,
|
|
122
|
+
/** 多行一列 */
|
|
123
|
+
RS_C = 4,
|
|
124
|
+
/** 多行一列并封装ArrayList */
|
|
125
|
+
RS_C_List = 5,
|
|
126
|
+
/** 多行多列 */
|
|
127
|
+
RS_CS = 6,
|
|
128
|
+
/** 多行多列并封装ArrayList */
|
|
129
|
+
RS_CS_List = 7
|
|
111
130
|
}
|
|
112
131
|
export declare enum SqlType {
|
|
113
132
|
tinyint = 0,
|
|
@@ -207,7 +226,7 @@ interface ServiceOption {
|
|
|
207
226
|
```
|
|
208
227
|
可以继承该接口来约束格式
|
|
209
228
|
*/
|
|
210
|
-
export interface
|
|
229
|
+
export interface GlobalSqlOptionForWeb {
|
|
211
230
|
/** 增改忽略Undefined */
|
|
212
231
|
skipUndefined?: boolean;
|
|
213
232
|
/** 增改忽略NULL */
|
|
@@ -241,12 +260,20 @@ export interface GlobalSqlOption2 {
|
|
|
241
260
|
作用与sqlDir类似,不同在于sqlMap`不需要`目录,而是直接指定一个sqlModel对象,对象的格式和sqlDir的文件内容一样。
|
|
242
261
|
** 适用于简单使用
|
|
243
262
|
*/
|
|
244
|
-
sqlMap?:
|
|
263
|
+
sqlMap?: _SqlModel;
|
|
245
264
|
/**
|
|
246
265
|
作用与sqlFnDir类似,不同在于sqlFNMap`不需要`目录,而是直接指定一个 Record<string, string>,对象的格式和sqlFnDir的文件内容一样。
|
|
247
266
|
** 适用于简单使用
|
|
248
267
|
*/
|
|
249
268
|
sqlFNMap?: Record<string, string>;
|
|
269
|
+
/**
|
|
270
|
+
// 第一个元素=列名,第二个元素是属性路径,
|
|
271
|
+
[
|
|
272
|
+
['dit_id', ['id']], // 列名ditid,对应属性id
|
|
273
|
+
['event_id', ['eventMainInfo', 'id']] // 列名event_id对应属性eventMainInfo.id
|
|
274
|
+
]
|
|
275
|
+
*/
|
|
276
|
+
sqlMapperMap?: SqlMappers;
|
|
250
277
|
}
|
|
251
278
|
/**
|
|
252
279
|
# 全局行为配置文件
|
|
@@ -260,7 +287,7 @@ export interface GlobalSqlOption2 {
|
|
|
260
287
|
```
|
|
261
288
|
可以继承该接口来约束格式
|
|
262
289
|
*/
|
|
263
|
-
export interface GlobalSqlOption extends
|
|
290
|
+
export interface GlobalSqlOption extends GlobalSqlOptionForWeb {
|
|
264
291
|
/**
|
|
265
292
|
初始化MYSQL链接 支持多数据源
|
|
266
293
|
## 单一数据源: 直接传入Mysql2的连接配置
|
|
@@ -336,9 +363,24 @@ export interface GlobalSqlOption extends GlobalSqlOption2 {
|
|
|
336
363
|
sqlDir?: string;
|
|
337
364
|
/**
|
|
338
365
|
## [mustache](https://mustache.github.io/) 编译时的[模板](https://github.com/janl/mustache.js#:~:text=requires%20only%20this%3A-,%7B%7B%3E%20next_more%7D%7D,-Why%3F%20Because%20the)
|
|
339
|
-
|
|
366
|
+
## 文件名就是模板名
|
|
340
367
|
*/
|
|
341
368
|
sqlFNDir?: string;
|
|
369
|
+
/**
|
|
370
|
+
## 映射数据为对象,文件名就是模板名
|
|
371
|
+
```
|
|
372
|
+
// 第一个元素=列名,第二个元素是属性路径,
|
|
373
|
+
// 该目录下可存放json文件,内容如下
|
|
374
|
+
//
|
|
375
|
+
// 可以在查询时使用,优先级高于hump
|
|
376
|
+
// 例如:
|
|
377
|
+
[
|
|
378
|
+
['dit_id', ['id'], 可选的默认值], // 列名ditid,对应属性id,当未查询返回时,使用默认值
|
|
379
|
+
['event_id', ['eventMainInfo', 'id']] // 列名event_id对应属性eventMainInfo.id,当未查询返回时,该属性不存在
|
|
380
|
+
]
|
|
381
|
+
```
|
|
382
|
+
*/
|
|
383
|
+
sqlMapperDir?: string;
|
|
342
384
|
/**
|
|
343
385
|
[REDIS初始化文档](https://github.com/redis/ioredis?tab=readme-ov-file#:~:text=connect%20to%20by%3A-,new%20Redis()%3B,-//%20Connect%20to%20127.0.0.1)
|
|
344
386
|
```
|
|
@@ -378,6 +420,11 @@ export interface GlobalSqlOption extends GlobalSqlOption2 {
|
|
|
378
420
|
* ```
|
|
379
421
|
*/
|
|
380
422
|
columnMode?: ColumnMode;
|
|
423
|
+
/**
|
|
424
|
+
* 读取查询语句时,是否扫描JS文件?
|
|
425
|
+
* JS文件需要默认导出一个 SqlModel对象
|
|
426
|
+
*/
|
|
427
|
+
jsMode?: boolean;
|
|
381
428
|
}
|
|
382
429
|
interface FieldOption extends Object {
|
|
383
430
|
type?: SqlType;
|
|
@@ -542,6 +589,8 @@ export declare class SqliteRemote implements Dao {
|
|
|
542
589
|
restore(sync: SyncMode.Sync, name: string): void;
|
|
543
590
|
restore(sync: SyncMode.Async, name: string): Promise<void>;
|
|
544
591
|
}
|
|
592
|
+
export type SqlMapper = ([string, string[], any?])[];
|
|
593
|
+
export type SqlMappers = Record<string, SqlMapper>;
|
|
545
594
|
export type SqlModel = Record<string, string | ((options: {
|
|
546
595
|
ctx: any;
|
|
547
596
|
isCount?: boolean;
|
|
@@ -550,15 +599,49 @@ export type SqlModel = Record<string, string | ((options: {
|
|
|
550
599
|
limitEnd?: number;
|
|
551
600
|
orderBy?: string;
|
|
552
601
|
[k: string]: any;
|
|
602
|
+
}) => string)>;
|
|
603
|
+
type _SqlModel = Record<string, string | ((options: {
|
|
604
|
+
ctx: any;
|
|
605
|
+
isCount?: boolean;
|
|
606
|
+
isSum?: boolean;
|
|
607
|
+
limitStart?: number;
|
|
608
|
+
limitEnd?: number;
|
|
609
|
+
orderBy?: string;
|
|
610
|
+
[k: string]: any;
|
|
553
611
|
}) => string) | XML[]>;
|
|
612
|
+
/**
|
|
613
|
+
* ifUndefined默认是MapperIfUndefined.Skip
|
|
614
|
+
*/
|
|
615
|
+
export declare function flatData<M>(options: {
|
|
616
|
+
data: any;
|
|
617
|
+
mapper: string | SqlMapper;
|
|
618
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
619
|
+
}): M;
|
|
554
620
|
export declare class SqlCache {
|
|
555
621
|
private sqlMap;
|
|
556
622
|
private sqlFNMap;
|
|
623
|
+
private _read;
|
|
624
|
+
/**
|
|
625
|
+
*
|
|
626
|
+
* ```
|
|
627
|
+
// 第一个元素=列名,第二个元素是属性路径,
|
|
628
|
+
[
|
|
629
|
+
['dit_id', ['id']], // 列名ditid,对应属性id
|
|
630
|
+
['event_id', ['eventMainInfo', 'id']] // 列名event_id对应属性eventMainInfo.id
|
|
631
|
+
]
|
|
632
|
+
* ```
|
|
633
|
+
* @param am
|
|
634
|
+
* @param keys
|
|
635
|
+
*/
|
|
636
|
+
private readResultMap;
|
|
557
637
|
init(options: {
|
|
558
|
-
sqlMap?:
|
|
638
|
+
sqlMap?: _SqlModel;
|
|
559
639
|
sqlDir?: string;
|
|
560
640
|
sqlFNMap?: Record<string, string>;
|
|
561
641
|
sqlFNDir?: string;
|
|
642
|
+
sqlMapperMap?: SqlMappers;
|
|
643
|
+
sqlMapperDir?: string;
|
|
644
|
+
jsMode?: boolean;
|
|
562
645
|
}): Promise<void>;
|
|
563
646
|
load(sqlids: string[], options: {
|
|
564
647
|
ctx: any;
|
|
@@ -571,7 +654,9 @@ export declare class SqlCache {
|
|
|
571
654
|
}): string;
|
|
572
655
|
}
|
|
573
656
|
export declare const Field: (config: FieldOption) => (object: object, propertyName: string) => void;
|
|
574
|
-
export declare const DB: (config: ServiceOption) => <C extends
|
|
657
|
+
export declare const DB: (config: ServiceOption) => <C extends {
|
|
658
|
+
new (...args: any[]): {};
|
|
659
|
+
}>(constructor: C) => {
|
|
575
660
|
new (...args: any[]): {
|
|
576
661
|
[_tableName]: string | undefined;
|
|
577
662
|
[_className]: string | undefined;
|
|
@@ -840,17 +925,6 @@ export declare class SqlService<T extends object> {
|
|
|
840
925
|
8. `dao`: 永远不需要传入该值
|
|
841
926
|
|
|
842
927
|
*/
|
|
843
|
-
template<L = T>(option: MethodOption & {
|
|
844
|
-
templateResult?: TemplateResult.AssertOne;
|
|
845
|
-
id?: string | number | Array<string | number>;
|
|
846
|
-
where?: Partial<L> | Array<Partial<L>>;
|
|
847
|
-
skipUndefined?: boolean;
|
|
848
|
-
skipNull?: boolean;
|
|
849
|
-
skipEmptyString?: boolean;
|
|
850
|
-
mode?: SelectMode;
|
|
851
|
-
error?: string;
|
|
852
|
-
columns?: (keyof L)[];
|
|
853
|
-
}): Promise<L>;
|
|
854
928
|
template<L = T>(option: MethodOption & {
|
|
855
929
|
sync: SyncMode.Sync;
|
|
856
930
|
templateResult?: TemplateResult.AssertOne;
|
|
@@ -864,7 +938,7 @@ export declare class SqlService<T extends object> {
|
|
|
864
938
|
columns?: (keyof L)[];
|
|
865
939
|
}): L;
|
|
866
940
|
template<L = T>(option: MethodOption & {
|
|
867
|
-
sync
|
|
941
|
+
sync?: SyncMode.Async;
|
|
868
942
|
templateResult?: TemplateResult.AssertOne;
|
|
869
943
|
id?: string | number | Array<string | number>;
|
|
870
944
|
where?: Partial<L> | Array<Partial<L>>;
|
|
@@ -875,17 +949,6 @@ export declare class SqlService<T extends object> {
|
|
|
875
949
|
error?: string;
|
|
876
950
|
columns?: (keyof L)[];
|
|
877
951
|
}): Promise<L>;
|
|
878
|
-
template<L = T>(option: MethodOption & {
|
|
879
|
-
templateResult: TemplateResult.Count;
|
|
880
|
-
id?: string | number | Array<string | number>;
|
|
881
|
-
where?: Partial<L> | Array<Partial<L>>;
|
|
882
|
-
skipUndefined?: boolean;
|
|
883
|
-
skipNull?: boolean;
|
|
884
|
-
skipEmptyString?: boolean;
|
|
885
|
-
mode?: SelectMode;
|
|
886
|
-
error?: string;
|
|
887
|
-
columns?: (keyof L)[];
|
|
888
|
-
}): Promise<number>;
|
|
889
952
|
template<L = T>(option: MethodOption & {
|
|
890
953
|
sync: SyncMode.Sync;
|
|
891
954
|
templateResult: TemplateResult.Count;
|
|
@@ -899,7 +962,7 @@ export declare class SqlService<T extends object> {
|
|
|
899
962
|
columns?: (keyof L)[];
|
|
900
963
|
}): number;
|
|
901
964
|
template<L = T>(option: MethodOption & {
|
|
902
|
-
sync
|
|
965
|
+
sync?: SyncMode.Async;
|
|
903
966
|
templateResult: TemplateResult.Count;
|
|
904
967
|
id?: string | number | Array<string | number>;
|
|
905
968
|
where?: Partial<L> | Array<Partial<L>>;
|
|
@@ -911,6 +974,7 @@ export declare class SqlService<T extends object> {
|
|
|
911
974
|
columns?: (keyof L)[];
|
|
912
975
|
}): Promise<number>;
|
|
913
976
|
template<L = T>(option: MethodOption & {
|
|
977
|
+
sync: SyncMode.Sync;
|
|
914
978
|
templateResult: TemplateResult.NotSureOne;
|
|
915
979
|
id?: string | number | Array<string | number>;
|
|
916
980
|
where?: Partial<L> | Array<Partial<L>>;
|
|
@@ -920,9 +984,9 @@ export declare class SqlService<T extends object> {
|
|
|
920
984
|
mode?: SelectMode;
|
|
921
985
|
error?: string;
|
|
922
986
|
columns?: (keyof L)[];
|
|
923
|
-
}):
|
|
987
|
+
}): L | null;
|
|
924
988
|
template<L = T>(option: MethodOption & {
|
|
925
|
-
sync
|
|
989
|
+
sync?: SyncMode.Async;
|
|
926
990
|
templateResult: TemplateResult.NotSureOne;
|
|
927
991
|
id?: string | number | Array<string | number>;
|
|
928
992
|
where?: Partial<L> | Array<Partial<L>>;
|
|
@@ -932,10 +996,10 @@ export declare class SqlService<T extends object> {
|
|
|
932
996
|
mode?: SelectMode;
|
|
933
997
|
error?: string;
|
|
934
998
|
columns?: (keyof L)[];
|
|
935
|
-
}): L | null
|
|
999
|
+
}): Promise<L | null>;
|
|
936
1000
|
template<L = T>(option: MethodOption & {
|
|
937
|
-
sync: SyncMode.
|
|
938
|
-
templateResult: TemplateResult.
|
|
1001
|
+
sync: SyncMode.Sync;
|
|
1002
|
+
templateResult: TemplateResult.Many;
|
|
939
1003
|
id?: string | number | Array<string | number>;
|
|
940
1004
|
where?: Partial<L> | Array<Partial<L>>;
|
|
941
1005
|
skipUndefined?: boolean;
|
|
@@ -944,8 +1008,9 @@ export declare class SqlService<T extends object> {
|
|
|
944
1008
|
mode?: SelectMode;
|
|
945
1009
|
error?: string;
|
|
946
1010
|
columns?: (keyof L)[];
|
|
947
|
-
}):
|
|
1011
|
+
}): L[];
|
|
948
1012
|
template<L = T>(option: MethodOption & {
|
|
1013
|
+
sync?: SyncMode.Async;
|
|
949
1014
|
templateResult: TemplateResult.Many;
|
|
950
1015
|
id?: string | number | Array<string | number>;
|
|
951
1016
|
where?: Partial<L> | Array<Partial<L>>;
|
|
@@ -958,7 +1023,7 @@ export declare class SqlService<T extends object> {
|
|
|
958
1023
|
}): Promise<L[]>;
|
|
959
1024
|
template<L = T>(option: MethodOption & {
|
|
960
1025
|
sync: SyncMode.Sync;
|
|
961
|
-
templateResult: TemplateResult.
|
|
1026
|
+
templateResult: TemplateResult.ManyList;
|
|
962
1027
|
id?: string | number | Array<string | number>;
|
|
963
1028
|
where?: Partial<L> | Array<Partial<L>>;
|
|
964
1029
|
skipUndefined?: boolean;
|
|
@@ -967,10 +1032,10 @@ export declare class SqlService<T extends object> {
|
|
|
967
1032
|
mode?: SelectMode;
|
|
968
1033
|
error?: string;
|
|
969
1034
|
columns?: (keyof L)[];
|
|
970
|
-
}): L
|
|
1035
|
+
}): ArrayList<L>;
|
|
971
1036
|
template<L = T>(option: MethodOption & {
|
|
972
|
-
sync
|
|
973
|
-
templateResult: TemplateResult.
|
|
1037
|
+
sync?: SyncMode.Async;
|
|
1038
|
+
templateResult: TemplateResult.ManyList;
|
|
974
1039
|
id?: string | number | Array<string | number>;
|
|
975
1040
|
where?: Partial<L> | Array<Partial<L>>;
|
|
976
1041
|
skipUndefined?: boolean;
|
|
@@ -979,25 +1044,24 @@ export declare class SqlService<T extends object> {
|
|
|
979
1044
|
mode?: SelectMode;
|
|
980
1045
|
error?: string;
|
|
981
1046
|
columns?: (keyof L)[];
|
|
982
|
-
}): Promise<L
|
|
1047
|
+
}): Promise<ArrayList<L>>;
|
|
983
1048
|
private _select;
|
|
984
1049
|
/**
|
|
985
1050
|
# 自由查询
|
|
986
1051
|
0. `sync`: 同步(sqlite)或者异步(mysql、remote),影响返回值类型,默认`异步模式`
|
|
987
|
-
1. `templateResult`:
|
|
988
|
-
1.
|
|
989
|
-
2.
|
|
990
|
-
3.
|
|
991
|
-
4.
|
|
992
|
-
5.
|
|
993
|
-
6.
|
|
1052
|
+
1. `templateResult`: 返回值类型断言,6种, R表示行,C表示列,带S表示复数
|
|
1053
|
+
1. R_C_Assert,
|
|
1054
|
+
2. R_C_NotSure,
|
|
1055
|
+
3. R_CS_Assert,
|
|
1056
|
+
4. R_CS_NotSure,
|
|
1057
|
+
5. RS_C,
|
|
1058
|
+
6. RS_C_List
|
|
1059
|
+
7. RS_CS[默认]
|
|
1060
|
+
8. RS_CS_List
|
|
994
1061
|
2. `sql` 或者 `sqlid`
|
|
995
1062
|
3. `params`
|
|
996
1063
|
4. `defValue`: One_Row_One_Column 时有效
|
|
997
|
-
5.
|
|
998
|
-
此时 `One_Row_One_Column` 将返回多个单值组成的数组: `[1, 'ok', 3]`
|
|
999
|
-
`One_Row_Many_Column` 将返回多个对象组成的数组: `[{ob1}, {ob2}, {ob3}]`
|
|
1000
|
-
`Many_Row_One_Column` 将返回多个单值数组组成的数组: `[[1,2,3], ['a', 'b']]`
|
|
1064
|
+
5. 禁止一次查询多个语句
|
|
1001
1065
|
6. `dbName`: 默认使用service注解的`dbName`,可以在某个方法中覆盖
|
|
1002
1066
|
7. `conn`: 仅在开启事务时需要主动传入,传入示例:
|
|
1003
1067
|
```
|
|
@@ -1006,85 +1070,121 @@ export declare class SqlService<T extends object> {
|
|
|
1006
1070
|
});
|
|
1007
1071
|
```
|
|
1008
1072
|
9. `dao`: 永远不需要传入该值
|
|
1073
|
+
10. `hump`: 是否将列名改为驼峰写法?默认情况下按照全局配置
|
|
1074
|
+
11. `mapper`: 列名-属性 映射工具,优先级高于hump
|
|
1009
1075
|
|
|
1010
1076
|
*/
|
|
1011
1077
|
select<L = T>(option: MethodOption & {
|
|
1012
|
-
hump?: boolean;
|
|
1013
1078
|
sync?: SyncMode.Async;
|
|
1014
|
-
selectResult?: SelectResult.
|
|
1079
|
+
selectResult?: SelectResult.RS_CS | SelectResult.RS_C;
|
|
1015
1080
|
sqlId?: string;
|
|
1016
1081
|
sql?: string;
|
|
1017
1082
|
params?: Record<string, any>;
|
|
1018
1083
|
context?: any;
|
|
1019
1084
|
isCount?: boolean;
|
|
1020
1085
|
defValue?: L | null;
|
|
1021
|
-
multiple?: boolean;
|
|
1022
1086
|
errorMsg?: string;
|
|
1087
|
+
hump?: boolean;
|
|
1088
|
+
mapper?: string | SqlMapper;
|
|
1089
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1023
1090
|
}): Promise<L[]>;
|
|
1024
1091
|
select<L = T>(option: MethodOption & {
|
|
1092
|
+
sync?: SyncMode.Async;
|
|
1093
|
+
selectResult: SelectResult.RS_CS_List | SelectResult.RS_C_List;
|
|
1094
|
+
sqlId?: string;
|
|
1095
|
+
sql?: string;
|
|
1096
|
+
params?: Record<string, any>;
|
|
1097
|
+
context?: any;
|
|
1098
|
+
isCount?: boolean;
|
|
1099
|
+
defValue?: L | null;
|
|
1100
|
+
errorMsg?: string;
|
|
1025
1101
|
hump?: boolean;
|
|
1102
|
+
mapper?: string | SqlMapper;
|
|
1103
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1104
|
+
}): Promise<ArrayList<L>>;
|
|
1105
|
+
select<L = T>(option: MethodOption & {
|
|
1026
1106
|
sync?: SyncMode.Async;
|
|
1027
|
-
selectResult: SelectResult.
|
|
1107
|
+
selectResult: SelectResult.R_CS_Assert | SelectResult.R_C_Assert;
|
|
1028
1108
|
sqlId?: string;
|
|
1029
1109
|
sql?: string;
|
|
1030
1110
|
params?: Record<string, any>;
|
|
1031
1111
|
context?: any;
|
|
1032
1112
|
isCount?: boolean;
|
|
1033
1113
|
defValue?: L | null;
|
|
1034
|
-
multiple?: boolean;
|
|
1035
1114
|
errorMsg?: string;
|
|
1115
|
+
hump?: boolean;
|
|
1116
|
+
mapper?: string | SqlMapper;
|
|
1117
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1036
1118
|
}): Promise<L>;
|
|
1037
1119
|
select<L = T>(option: MethodOption & {
|
|
1038
|
-
hump?: boolean;
|
|
1039
1120
|
sync?: SyncMode.Async;
|
|
1040
|
-
selectResult: SelectResult.
|
|
1121
|
+
selectResult: SelectResult.R_CS_NotSure | SelectResult.R_C_NotSure;
|
|
1041
1122
|
sqlId?: string;
|
|
1042
1123
|
sql?: string;
|
|
1043
1124
|
params?: Record<string, any>;
|
|
1044
1125
|
context?: any;
|
|
1045
1126
|
isCount?: boolean;
|
|
1046
1127
|
defValue?: L | null;
|
|
1047
|
-
multiple?: boolean;
|
|
1048
1128
|
errorMsg?: string;
|
|
1129
|
+
hump?: boolean;
|
|
1130
|
+
mapper?: string | SqlMapper;
|
|
1131
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1049
1132
|
}): Promise<L | null>;
|
|
1050
1133
|
select<L = T>(option: MethodOption & {
|
|
1051
|
-
hump?: boolean;
|
|
1052
1134
|
sync: SyncMode.Sync;
|
|
1053
|
-
selectResult?: SelectResult.
|
|
1135
|
+
selectResult?: SelectResult.RS_CS | SelectResult.RS_C;
|
|
1054
1136
|
sqlId?: string;
|
|
1055
1137
|
sql?: string;
|
|
1056
1138
|
params?: Record<string, any>;
|
|
1057
1139
|
context?: any;
|
|
1058
1140
|
isCount?: boolean;
|
|
1059
1141
|
defValue?: L | null;
|
|
1060
|
-
multiple?: boolean;
|
|
1061
1142
|
errorMsg?: string;
|
|
1143
|
+
hump?: boolean;
|
|
1144
|
+
mapper?: string | SqlMapper;
|
|
1145
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1062
1146
|
}): L[];
|
|
1063
1147
|
select<L = T>(option: MethodOption & {
|
|
1148
|
+
sync: SyncMode.Sync;
|
|
1149
|
+
selectResult: SelectResult.RS_CS_List | SelectResult.RS_C_List;
|
|
1150
|
+
sqlId?: string;
|
|
1151
|
+
sql?: string;
|
|
1152
|
+
params?: Record<string, any>;
|
|
1153
|
+
context?: any;
|
|
1154
|
+
isCount?: boolean;
|
|
1155
|
+
defValue?: L | null;
|
|
1156
|
+
errorMsg?: string;
|
|
1064
1157
|
hump?: boolean;
|
|
1158
|
+
mapper?: string | SqlMapper;
|
|
1159
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1160
|
+
}): ArrayList<L>;
|
|
1161
|
+
select<L = T>(option: MethodOption & {
|
|
1065
1162
|
sync: SyncMode.Sync;
|
|
1066
|
-
selectResult: SelectResult.
|
|
1163
|
+
selectResult: SelectResult.R_CS_Assert | SelectResult.R_C_Assert;
|
|
1067
1164
|
sqlId?: string;
|
|
1068
1165
|
sql?: string;
|
|
1069
1166
|
params?: Record<string, any>;
|
|
1070
1167
|
context?: any;
|
|
1071
1168
|
isCount?: boolean;
|
|
1072
1169
|
defValue?: L | null;
|
|
1073
|
-
multiple?: boolean;
|
|
1074
1170
|
errorMsg?: string;
|
|
1171
|
+
hump?: boolean;
|
|
1172
|
+
mapper?: string | SqlMapper;
|
|
1173
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1075
1174
|
}): L;
|
|
1076
1175
|
select<L = T>(option: MethodOption & {
|
|
1077
|
-
hump?: boolean;
|
|
1078
1176
|
sync: SyncMode.Sync;
|
|
1079
|
-
selectResult: SelectResult.
|
|
1177
|
+
selectResult: SelectResult.R_CS_NotSure | SelectResult.R_C_NotSure;
|
|
1080
1178
|
sqlId?: string;
|
|
1081
1179
|
sql?: string;
|
|
1082
1180
|
params?: Record<string, any>;
|
|
1083
1181
|
context?: any;
|
|
1084
1182
|
isCount?: boolean;
|
|
1085
1183
|
defValue?: L | null;
|
|
1086
|
-
multiple?: boolean;
|
|
1087
1184
|
errorMsg?: string;
|
|
1185
|
+
hump?: boolean;
|
|
1186
|
+
mapper?: string | SqlMapper;
|
|
1187
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1088
1188
|
}): L | null;
|
|
1089
1189
|
/**
|
|
1090
1190
|
# 自由执行sql
|
|
@@ -1099,7 +1199,7 @@ export declare class SqlService<T extends object> {
|
|
|
1099
1199
|
});
|
|
1100
1200
|
```
|
|
1101
1201
|
5. `dao`: 永远不需要传入该值
|
|
1102
|
-
|
|
1202
|
+
|
|
1103
1203
|
*/
|
|
1104
1204
|
excute<L = T>(option: MethodOption & {
|
|
1105
1205
|
sync?: SyncMode.Async;
|
|
@@ -1148,10 +1248,13 @@ export declare class SqlService<T extends object> {
|
|
|
1148
1248
|
params: Record<string, any>;
|
|
1149
1249
|
pageSize: number;
|
|
1150
1250
|
pageNumber: number;
|
|
1151
|
-
limitSelf
|
|
1152
|
-
countSelf
|
|
1153
|
-
sumSelf
|
|
1251
|
+
limitSelf?: boolean;
|
|
1252
|
+
countSelf?: boolean;
|
|
1253
|
+
sumSelf?: boolean;
|
|
1154
1254
|
orderBy?: string;
|
|
1255
|
+
hump?: boolean;
|
|
1256
|
+
mapper?: string | SqlMapper;
|
|
1257
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1155
1258
|
}): Promise<PageQuery<L>>;
|
|
1156
1259
|
page<L = T>(option: MethodOption & {
|
|
1157
1260
|
sync: SyncMode.Sync;
|
|
@@ -1160,10 +1263,13 @@ export declare class SqlService<T extends object> {
|
|
|
1160
1263
|
params: Record<string, any>;
|
|
1161
1264
|
pageSize: number;
|
|
1162
1265
|
pageNumber: number;
|
|
1163
|
-
limitSelf
|
|
1164
|
-
countSelf
|
|
1165
|
-
sumSelf
|
|
1266
|
+
limitSelf?: boolean;
|
|
1267
|
+
countSelf?: boolean;
|
|
1268
|
+
sumSelf?: boolean;
|
|
1166
1269
|
orderBy?: string;
|
|
1270
|
+
hump?: boolean;
|
|
1271
|
+
mapper?: string | SqlMapper;
|
|
1272
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1167
1273
|
}): PageQuery<L>;
|
|
1168
1274
|
/**
|
|
1169
1275
|
#创建表
|
|
@@ -1207,168 +1313,222 @@ declare class StreamQuery<T extends object> {
|
|
|
1207
1313
|
reset(): this;
|
|
1208
1314
|
/** 为下次链条执行提供条件判断:非异步方法跳过,异步方法不执行并返回默认值 */
|
|
1209
1315
|
if(condition: boolean): this;
|
|
1210
|
-
eq(key: keyof T, value: string | number, {
|
|
1211
|
-
|
|
1316
|
+
eq(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1317
|
+
paramName?: string | undefined;
|
|
1318
|
+
skipEmptyString?: boolean | undefined;
|
|
1319
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1212
1320
|
}): this;
|
|
1213
|
-
eqT(t: Partial<T>, { name }?: {
|
|
1214
|
-
name?: string;
|
|
1321
|
+
eqT(t: Partial<T>, { name: paramName, breakExcuteIfSkip }?: {
|
|
1322
|
+
name?: string | undefined;
|
|
1323
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1215
1324
|
}): this;
|
|
1216
|
-
notEq(key: keyof T, value: string | number, {
|
|
1217
|
-
|
|
1325
|
+
notEq(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1326
|
+
paramName?: string | undefined;
|
|
1327
|
+
skipEmptyString?: boolean | undefined;
|
|
1328
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1218
1329
|
}): this;
|
|
1219
1330
|
eqWith(key1: keyof T, key2: keyof T): this;
|
|
1220
1331
|
notEqWith(key1: keyof T, key2: keyof T): this;
|
|
1221
|
-
regexp(key: keyof T, regexp: string, {
|
|
1222
|
-
|
|
1332
|
+
regexp(key: keyof T, regexp: string, { paramName, breakExcuteIfSkip }?: {
|
|
1333
|
+
paramName?: string | undefined;
|
|
1334
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1223
1335
|
}): this;
|
|
1224
|
-
notRegexp(key: keyof T, regexp: string, {
|
|
1225
|
-
|
|
1336
|
+
notRegexp(key: keyof T, regexp: string, { paramName, breakExcuteIfSkip }?: {
|
|
1337
|
+
paramName?: string | undefined;
|
|
1338
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1226
1339
|
}): this;
|
|
1227
1340
|
/** (key1 << 8) + key2 = value */
|
|
1228
|
-
shiftEq(key1: keyof T, key2: keyof T, value: number, {
|
|
1229
|
-
|
|
1341
|
+
shiftEq(key1: keyof T, key2: keyof T, value: number, { paramName, breakExcuteIfSkip }?: {
|
|
1342
|
+
paramName?: string | undefined;
|
|
1343
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1230
1344
|
}): this;
|
|
1231
1345
|
/** (key1 << 8) + key2 <> value */
|
|
1232
|
-
shiftNotEq(key1: keyof T, key2: keyof T, value: number, {
|
|
1233
|
-
|
|
1346
|
+
shiftNotEq(key1: keyof T, key2: keyof T, value: number, { paramName, breakExcuteIfSkip }?: {
|
|
1347
|
+
paramName?: string | undefined;
|
|
1348
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1234
1349
|
}): this;
|
|
1235
|
-
grate(key: keyof T, value: string | number, {
|
|
1236
|
-
|
|
1350
|
+
grate(key: keyof T, value: string | number, { paramName, breakExcuteIfSkip }?: {
|
|
1351
|
+
paramName?: string | undefined;
|
|
1352
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1237
1353
|
}): this;
|
|
1238
|
-
grateEq(key: keyof T, value: string | number, {
|
|
1239
|
-
|
|
1354
|
+
grateEq(key: keyof T, value: string | number, { paramName, breakExcuteIfSkip }?: {
|
|
1355
|
+
paramName?: string | undefined;
|
|
1356
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1240
1357
|
}): this;
|
|
1241
1358
|
grateWith(key1: keyof T, key2: keyof T): this;
|
|
1242
1359
|
grateEqWith(key1: keyof T, key2: keyof T): this;
|
|
1243
|
-
less(key: keyof T, value: string | number, {
|
|
1244
|
-
|
|
1360
|
+
less(key: keyof T, value: string | number, { paramName, breakExcuteIfSkip }?: {
|
|
1361
|
+
paramName?: string | undefined;
|
|
1362
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1245
1363
|
}): this;
|
|
1246
|
-
lessEq(key: keyof T, value: string | number, {
|
|
1247
|
-
|
|
1364
|
+
lessEq(key: keyof T, value: string | number, { paramName, breakExcuteIfSkip }?: {
|
|
1365
|
+
paramName?: string | undefined;
|
|
1366
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1248
1367
|
}): this;
|
|
1249
1368
|
lessWith(key1: keyof T, key2: keyof T): this;
|
|
1250
1369
|
lessEqWith(key1: keyof T, key2: keyof T): this;
|
|
1251
|
-
like(key: keyof T, value: string | number, {
|
|
1252
|
-
|
|
1253
|
-
|
|
1370
|
+
like(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1371
|
+
paramName?: string | undefined;
|
|
1372
|
+
skipEmptyString?: boolean | undefined;
|
|
1373
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1254
1374
|
}): this;
|
|
1255
|
-
notLike(key: keyof T, value: string | number, {
|
|
1256
|
-
|
|
1257
|
-
|
|
1375
|
+
notLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1376
|
+
paramName?: string | undefined;
|
|
1377
|
+
skipEmptyString?: boolean | undefined;
|
|
1378
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1258
1379
|
}): this;
|
|
1259
|
-
leftLike(key: keyof T, value: string | number, {
|
|
1260
|
-
|
|
1261
|
-
|
|
1380
|
+
leftLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1381
|
+
paramName?: string | undefined;
|
|
1382
|
+
skipEmptyString?: boolean | undefined;
|
|
1383
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1262
1384
|
}): this;
|
|
1263
|
-
notLeftLike(key: keyof T, value: string | number, {
|
|
1264
|
-
|
|
1265
|
-
|
|
1385
|
+
notLeftLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1386
|
+
paramName?: string | undefined;
|
|
1387
|
+
skipEmptyString?: boolean | undefined;
|
|
1388
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1266
1389
|
}): this;
|
|
1267
|
-
rightLike(key: keyof T, value: string | number, {
|
|
1268
|
-
|
|
1269
|
-
|
|
1390
|
+
rightLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1391
|
+
paramName?: string | undefined;
|
|
1392
|
+
skipEmptyString?: boolean | undefined;
|
|
1393
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1270
1394
|
}): this;
|
|
1271
|
-
notRightLike(key: keyof T, value: string | number, {
|
|
1272
|
-
|
|
1273
|
-
|
|
1395
|
+
notRightLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1396
|
+
paramName?: string | undefined;
|
|
1397
|
+
skipEmptyString?: boolean | undefined;
|
|
1398
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1274
1399
|
}): this;
|
|
1275
|
-
PreciseLike(key: keyof T, value: string | number, {
|
|
1276
|
-
|
|
1277
|
-
|
|
1400
|
+
PreciseLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1401
|
+
paramName?: string | undefined;
|
|
1402
|
+
skipEmptyString?: boolean | undefined;
|
|
1403
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1278
1404
|
}): this;
|
|
1279
|
-
notPreciseLike(key: keyof T, value: string | number, {
|
|
1280
|
-
|
|
1281
|
-
|
|
1405
|
+
notPreciseLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1406
|
+
paramName?: string | undefined;
|
|
1407
|
+
skipEmptyString?: boolean | undefined;
|
|
1408
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1282
1409
|
}): this;
|
|
1283
|
-
glob(key: keyof T, value: string | number, {
|
|
1284
|
-
|
|
1285
|
-
|
|
1410
|
+
glob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1411
|
+
paramName?: string | undefined;
|
|
1412
|
+
skipEmptyString?: boolean | undefined;
|
|
1413
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1286
1414
|
}): this;
|
|
1287
|
-
notGlob(key: keyof T, value: string | number, {
|
|
1288
|
-
|
|
1289
|
-
|
|
1415
|
+
notGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1416
|
+
paramName?: string | undefined;
|
|
1417
|
+
skipEmptyString?: boolean | undefined;
|
|
1418
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1290
1419
|
}): this;
|
|
1291
|
-
leftGlob(key: keyof T, value: string | number, {
|
|
1292
|
-
|
|
1293
|
-
|
|
1420
|
+
leftGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1421
|
+
paramName?: string | undefined;
|
|
1422
|
+
skipEmptyString?: boolean | undefined;
|
|
1423
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1294
1424
|
}): this;
|
|
1295
|
-
notLeftGlob(key: keyof T, value: string | number, {
|
|
1296
|
-
|
|
1297
|
-
|
|
1425
|
+
notLeftGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1426
|
+
paramName?: string | undefined;
|
|
1427
|
+
skipEmptyString?: boolean | undefined;
|
|
1428
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1298
1429
|
}): this;
|
|
1299
|
-
rightGlob(key: keyof T, value: string | number, {
|
|
1300
|
-
|
|
1301
|
-
|
|
1430
|
+
rightGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1431
|
+
paramName?: string | undefined;
|
|
1432
|
+
skipEmptyString?: boolean | undefined;
|
|
1433
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1302
1434
|
}): this;
|
|
1303
|
-
notRightGlob(key: keyof T, value: string | number, {
|
|
1304
|
-
|
|
1305
|
-
|
|
1435
|
+
notRightGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1436
|
+
paramName?: string | undefined;
|
|
1437
|
+
skipEmptyString?: boolean | undefined;
|
|
1438
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1306
1439
|
}): this;
|
|
1307
|
-
PreciseGlob(key: keyof T, value: string | number, {
|
|
1308
|
-
|
|
1309
|
-
|
|
1440
|
+
PreciseGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1441
|
+
paramName?: string | undefined;
|
|
1442
|
+
skipEmptyString?: boolean | undefined;
|
|
1443
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1310
1444
|
}): this;
|
|
1311
|
-
notPreciseGlob(key: keyof T, value: string | number, {
|
|
1312
|
-
|
|
1313
|
-
|
|
1445
|
+
notPreciseGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1446
|
+
paramName?: string | undefined;
|
|
1447
|
+
skipEmptyString?: boolean | undefined;
|
|
1448
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1314
1449
|
}): this;
|
|
1315
|
-
in(key: keyof T, value: Array<string | number>, {
|
|
1316
|
-
|
|
1317
|
-
|
|
1450
|
+
in(key: keyof T, value: Array<string | number>, { paramName, breakExcuteIfSkip }?: {
|
|
1451
|
+
paramName?: string | undefined;
|
|
1452
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1318
1453
|
}): this;
|
|
1319
|
-
notIn(key: keyof T, value: Array<string | number>, {
|
|
1320
|
-
|
|
1321
|
-
|
|
1454
|
+
notIn(key: keyof T, value: Array<string | number>, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1455
|
+
paramName?: string | undefined;
|
|
1456
|
+
skipEmptyString?: boolean | undefined;
|
|
1457
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1322
1458
|
}): this;
|
|
1323
1459
|
isNULL(key: keyof T): this;
|
|
1324
1460
|
isNotNULL(key: keyof T): this;
|
|
1325
|
-
between(key: keyof T, value1: string | number, value2: string | number, {
|
|
1326
|
-
|
|
1461
|
+
between(key: keyof T, value1: string | number, value2: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1462
|
+
paramName?: string | undefined;
|
|
1463
|
+
skipEmptyString?: boolean | undefined;
|
|
1464
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1327
1465
|
}): this;
|
|
1328
|
-
notBetween(key: keyof T, value1: string | number, value2: string | number, {
|
|
1329
|
-
|
|
1466
|
+
notBetween(key: keyof T, value1: string | number, value2: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1467
|
+
paramName?: string | undefined;
|
|
1468
|
+
skipEmptyString?: boolean | undefined;
|
|
1469
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1330
1470
|
}): this;
|
|
1331
|
-
pow(key: keyof T, value: number, {
|
|
1332
|
-
|
|
1471
|
+
pow(key: keyof T, value: number, { paramName, breakExcuteIfSkip }?: {
|
|
1472
|
+
paramName?: string | undefined;
|
|
1473
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1333
1474
|
}): this;
|
|
1334
|
-
notPow(key: keyof T, value: number, {
|
|
1335
|
-
|
|
1475
|
+
notPow(key: keyof T, value: number, { paramName, breakExcuteIfSkip }?: {
|
|
1476
|
+
paramName?: string | undefined;
|
|
1477
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1336
1478
|
}): this;
|
|
1337
|
-
powWith(key: keyof T, values: Array<number | string>, {
|
|
1338
|
-
|
|
1479
|
+
powWith(key: keyof T, values: Array<number | string>, { paramName, breakExcuteIfSkip }?: {
|
|
1480
|
+
paramName?: string | undefined;
|
|
1481
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1339
1482
|
}): this;
|
|
1340
|
-
notPowWith(key: keyof T, values: Array<number | string>, {
|
|
1341
|
-
|
|
1483
|
+
notPowWith(key: keyof T, values: Array<number | string>, { paramName, breakExcuteIfSkip }?: {
|
|
1484
|
+
paramName?: string | undefined;
|
|
1485
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1342
1486
|
}): this;
|
|
1343
1487
|
/** MATCH(key1, key2, key3) AGAINST (value) */
|
|
1344
|
-
match(value: string, keys: (keyof T)[], {
|
|
1345
|
-
|
|
1488
|
+
match(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1489
|
+
paramName?: string | undefined;
|
|
1490
|
+
skipEmptyString?: boolean | undefined;
|
|
1491
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1346
1492
|
}): this;
|
|
1347
1493
|
/** NOT MATCH(key1, key2, key3) AGAINST (value) */
|
|
1348
|
-
notMatch(value: string, keys: (keyof T)[], {
|
|
1349
|
-
|
|
1494
|
+
notMatch(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1495
|
+
paramName?: string | undefined;
|
|
1496
|
+
skipEmptyString?: boolean | undefined;
|
|
1497
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1350
1498
|
}): this;
|
|
1351
1499
|
/** MATCH(key1, key2, key3) AGAINST (value) IN BOOLEAN MODE*/
|
|
1352
|
-
matchBoolean(value: string, keys: (keyof T)[], {
|
|
1353
|
-
|
|
1500
|
+
matchBoolean(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1501
|
+
paramName?: string | undefined;
|
|
1502
|
+
skipEmptyString?: boolean | undefined;
|
|
1503
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1354
1504
|
}): this;
|
|
1355
1505
|
/** NOT MATCH(key1, key2, key3) AGAINST (value) IN BOOLEAN MODE */
|
|
1356
|
-
notMatchBoolean(value: string, keys: (keyof T)[], {
|
|
1357
|
-
|
|
1506
|
+
notMatchBoolean(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1507
|
+
paramName?: string | undefined;
|
|
1508
|
+
skipEmptyString?: boolean | undefined;
|
|
1509
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1358
1510
|
}): this;
|
|
1359
1511
|
/** MATCH(key1, key2, key3) AGAINST (value) WITH QUERY EXPANSION*/
|
|
1360
|
-
matchQuery(value: string, keys: (keyof T)[], {
|
|
1361
|
-
|
|
1512
|
+
matchQuery(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1513
|
+
paramName?: string | undefined;
|
|
1514
|
+
skipEmptyString?: boolean | undefined;
|
|
1515
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1362
1516
|
}): this;
|
|
1363
1517
|
/** NOT MATCH(key1, key2, key3) AGAINST (value) WITH QUERY EXPANSION*/
|
|
1364
|
-
notMatchQuery(value: string, keys: (keyof T)[], {
|
|
1365
|
-
|
|
1518
|
+
notMatchQuery(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1519
|
+
paramName?: string | undefined;
|
|
1520
|
+
skipEmptyString?: boolean | undefined;
|
|
1521
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1366
1522
|
}): this;
|
|
1367
|
-
includes(key: keyof T, value: string | number, {
|
|
1368
|
-
|
|
1523
|
+
includes(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1524
|
+
paramName?: string | undefined;
|
|
1525
|
+
skipEmptyString?: boolean | undefined;
|
|
1526
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1369
1527
|
}): this;
|
|
1370
|
-
notIncludes(key: keyof T, value: string | number, {
|
|
1371
|
-
|
|
1528
|
+
notIncludes(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
|
|
1529
|
+
paramName?: string | undefined;
|
|
1530
|
+
skipEmptyString?: boolean | undefined;
|
|
1531
|
+
breakExcuteIfSkip?: boolean | undefined;
|
|
1372
1532
|
}): this;
|
|
1373
1533
|
and(fn: StreamQuery<T> | ((stream: StreamQuery<T>) => boolean | void)): this;
|
|
1374
1534
|
or(fn: StreamQuery<T> | ((stream: StreamQuery<T>) => boolean | void)): this;
|
|
@@ -1403,30 +1563,68 @@ declare class StreamQuery<T extends object> {
|
|
|
1403
1563
|
replace(key: keyof T, valueToFind: T[keyof T], valueToReplace: T[keyof T]): this;
|
|
1404
1564
|
excuteSelect<L = T>(option?: MethodOption & {
|
|
1405
1565
|
sync?: SyncMode.Async;
|
|
1406
|
-
selectResult?: SelectResult.
|
|
1566
|
+
selectResult?: SelectResult.RS_CS | SelectResult.RS_C;
|
|
1567
|
+
hump?: boolean;
|
|
1568
|
+
mapper?: string | SqlMapper;
|
|
1569
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1407
1570
|
}): Promise<L[]>;
|
|
1571
|
+
excuteSelect<L = T>(option?: MethodOption & {
|
|
1572
|
+
sync?: SyncMode.Async;
|
|
1573
|
+
selectResult?: SelectResult.RS_CS_List | SelectResult.RS_C_List;
|
|
1574
|
+
hump?: boolean;
|
|
1575
|
+
mapper?: string | SqlMapper;
|
|
1576
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1577
|
+
}): Promise<ArrayList<L>>;
|
|
1408
1578
|
excuteSelect<L = T>(option: MethodOption & {
|
|
1409
1579
|
sync?: SyncMode.Async;
|
|
1410
|
-
selectResult: SelectResult.
|
|
1580
|
+
selectResult: SelectResult.R_CS_Assert | SelectResult.R_C_Assert;
|
|
1411
1581
|
errorMsg?: string;
|
|
1582
|
+
hump?: boolean;
|
|
1583
|
+
mapper?: string | SqlMapper;
|
|
1584
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1412
1585
|
}): Promise<L>;
|
|
1413
1586
|
excuteSelect<L = T>(option: MethodOption & {
|
|
1414
1587
|
sync?: SyncMode.Async;
|
|
1415
|
-
selectResult: SelectResult.
|
|
1588
|
+
selectResult: SelectResult.R_CS_NotSure | SelectResult.R_C_NotSure;
|
|
1589
|
+
hump?: boolean;
|
|
1590
|
+
mapper?: string | SqlMapper;
|
|
1591
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1416
1592
|
}): Promise<L | null>;
|
|
1417
1593
|
excuteSelect<L = T>(option: MethodOption & {
|
|
1418
1594
|
sync: SyncMode.Sync;
|
|
1419
|
-
selectResult: SelectResult.
|
|
1595
|
+
selectResult: SelectResult.RS_CS | SelectResult.RS_C;
|
|
1596
|
+
hump?: boolean;
|
|
1597
|
+
mapper?: string | SqlMapper;
|
|
1598
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1420
1599
|
}): L[];
|
|
1421
1600
|
excuteSelect<L = T>(option: MethodOption & {
|
|
1422
1601
|
sync: SyncMode.Sync;
|
|
1423
|
-
selectResult: SelectResult.
|
|
1602
|
+
selectResult: SelectResult.RS_CS_List | SelectResult.RS_C_List;
|
|
1603
|
+
hump?: boolean;
|
|
1604
|
+
mapper?: string | SqlMapper;
|
|
1605
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1606
|
+
}): ArrayList<L>;
|
|
1607
|
+
excuteSelect<L = T>(option: MethodOption & {
|
|
1608
|
+
sync: SyncMode.Sync;
|
|
1609
|
+
selectResult: SelectResult.R_CS_Assert | SelectResult.R_C_Assert;
|
|
1424
1610
|
errorMsg?: string;
|
|
1611
|
+
hump?: boolean;
|
|
1612
|
+
mapper?: string | SqlMapper;
|
|
1613
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1425
1614
|
}): L;
|
|
1426
1615
|
excuteSelect<L = T>(option: MethodOption & {
|
|
1427
1616
|
sync: SyncMode.Sync;
|
|
1428
|
-
selectResult: SelectResult.
|
|
1617
|
+
selectResult: SelectResult.R_CS_NotSure | SelectResult.R_C_NotSure;
|
|
1618
|
+
hump?: boolean;
|
|
1619
|
+
mapper?: string | SqlMapper;
|
|
1620
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1429
1621
|
}): L | null;
|
|
1622
|
+
excutePage<L = T>(option?: MethodOption & {
|
|
1623
|
+
sync?: SyncMode;
|
|
1624
|
+
hump?: boolean;
|
|
1625
|
+
mapper?: string | SqlMapper;
|
|
1626
|
+
mapperIfUndefined?: MapperIfUndefined;
|
|
1627
|
+
}): PageQuery<L> | Promise<PageQuery<L>>;
|
|
1430
1628
|
excuteUpdate(option?: MethodOption & {
|
|
1431
1629
|
sync?: SyncMode.Async;
|
|
1432
1630
|
}): Promise<number>;
|
|
@@ -1481,7 +1679,7 @@ export declare function excuteWithLock<T>(config: {
|
|
|
1481
1679
|
lockMaxActive?: number;
|
|
1482
1680
|
/** 单个锁多少【毫秒】后自动释放?默认:60*1000MS */
|
|
1483
1681
|
lockMaxTime?: number;
|
|
1484
|
-
}, fn__: () => Promise<T>): Promise<
|
|
1682
|
+
}, fn__: () => Promise<T>): Promise<T>;
|
|
1485
1683
|
/** 与缓存共用时,需要在缓存之前:有缓存则返回缓存,否则加锁执行并缓存,后续队列全部返回缓存,跳过执行 */
|
|
1486
1684
|
export declare function MethodLock<T = any>(config: {
|
|
1487
1685
|
/** 返回缓存key,参数=方法的参数[注意:必须和主方法的参数数量、完全一致,同时会追加一个当前用户对象]+当前用户对象,可以用来清空缓存。 */
|