baja-lite 1.0.4 → 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.
Files changed (85) hide show
  1. package/cjs/boot-remote.d.ts +2 -0
  2. package/cjs/boot-remote.js +35 -0
  3. package/cjs/boot.d.ts +2 -0
  4. package/cjs/boot.js +152 -0
  5. package/cjs/code.d.ts +1 -0
  6. package/cjs/code.js +359 -1
  7. package/cjs/convert-xml.d.ts +10 -0
  8. package/cjs/convert-xml.js +414 -0
  9. package/cjs/enum.d.ts +10 -0
  10. package/cjs/enum.js +32 -0
  11. package/cjs/error.js +1 -1
  12. package/cjs/fn.js +3 -3
  13. package/cjs/index.d.ts +3 -0
  14. package/cjs/index.js +3 -0
  15. package/cjs/list.d.ts +10 -0
  16. package/cjs/list.js +36 -0
  17. package/cjs/object.d.ts +7 -1
  18. package/cjs/object.js +36 -2
  19. package/cjs/set-ex.d.ts +41 -15
  20. package/cjs/set-ex.js +68 -52
  21. package/cjs/sql.d.ts +760 -305
  22. package/cjs/sql.js +1702 -1041
  23. package/cjs/sqlite.d.ts +38 -0
  24. package/cjs/sqlite.js +194 -0
  25. package/cjs/test-mysql.d.ts +2 -1
  26. package/cjs/test-mysql.js +85 -63
  27. package/cjs/test-sqlite.d.ts +1 -1
  28. package/cjs/test-sqlite.js +3 -1
  29. package/cjs/test-xml.d.ts +1 -0
  30. package/cjs/test-xml.js +75 -0
  31. package/es/boot-remote.d.ts +2 -0
  32. package/es/boot-remote.js +31 -0
  33. package/es/boot.d.ts +2 -0
  34. package/es/boot.js +125 -0
  35. package/es/code.d.ts +1 -0
  36. package/es/code.js +355 -2
  37. package/es/convert-xml.d.ts +10 -0
  38. package/es/convert-xml.js +410 -0
  39. package/es/enum.d.ts +10 -0
  40. package/es/enum.js +28 -0
  41. package/es/error.js +1 -1
  42. package/es/index.d.ts +3 -0
  43. package/es/index.js +3 -0
  44. package/es/list.d.ts +10 -0
  45. package/es/list.js +32 -0
  46. package/es/object.d.ts +7 -1
  47. package/es/object.js +28 -1
  48. package/es/set-ex.d.ts +41 -15
  49. package/es/set-ex.js +68 -52
  50. package/es/sql.d.ts +760 -305
  51. package/es/sql.js +1573 -917
  52. package/es/sqlite.d.ts +38 -0
  53. package/es/sqlite.js +164 -0
  54. package/es/test-mysql.d.ts +2 -1
  55. package/es/test-mysql.js +85 -64
  56. package/es/test-sqlite.d.ts +1 -1
  57. package/es/test-sqlite.js +3 -1
  58. package/es/test-xml.d.ts +1 -0
  59. package/es/test-xml.js +70 -0
  60. package/package.json +15 -10
  61. package/src/boot-remote.ts +31 -0
  62. package/src/boot.ts +129 -0
  63. package/src/code.ts +342 -1
  64. package/src/convert-xml.ts +462 -0
  65. package/src/enum.ts +31 -0
  66. package/src/error.ts +1 -1
  67. package/src/index.ts +4 -1
  68. package/src/list.ts +31 -0
  69. package/src/object.ts +48 -14
  70. package/src/set-ex.ts +91 -70
  71. package/src/sql.ts +1652 -965
  72. package/src/sqlite.ts +161 -0
  73. package/src/test-mysql.ts +93 -65
  74. package/src/test-sqlite.ts +3 -1
  75. package/src/test-xml.ts +70 -0
  76. package/cjs/constant.d.ts +0 -13
  77. package/cjs/constant.js +0 -19
  78. package/cjs/redis.d.ts +0 -0
  79. package/cjs/redis.js +0 -1
  80. package/es/constant.d.ts +0 -13
  81. package/es/constant.js +0 -16
  82. package/es/redis.d.ts +0 -0
  83. package/es/redis.js +0 -1
  84. package/src/constant.ts +0 -14
  85. package/src/redis.ts +0 -0
package/cjs/sql.d.ts CHANGED
@@ -1,6 +1,10 @@
1
- import 'reflect-metadata';
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;
5
+ declare const _className: unique symbol;
6
+ declare const _ClassName: unique symbol;
7
+ declare const _vueName: unique symbol;
4
8
  declare const _ids: unique symbol;
5
9
  declare const _columns: unique symbol;
6
10
  declare const _columnsNoId: unique symbol;
@@ -10,12 +14,22 @@ declare const _deleteState: unique symbol;
10
14
  declare const _transformer: unique symbol;
11
15
  declare const _index: unique symbol;
12
16
  declare const _def: unique symbol;
17
+ export declare const _sqlCache: unique symbol;
18
+ export declare const _dao: unique symbol;
19
+ export declare const _primaryDB: unique symbol;
13
20
  declare const _dbType: unique symbol;
14
21
  declare const _sqlite_version: unique symbol;
15
22
  declare const _daoConnection: unique symbol;
16
23
  declare const _inTransaction: unique symbol;
17
24
  declare const _daoDB: unique symbol;
25
+ declare const _sqliteRemoteName: unique symbol;
18
26
  declare const _SqlOption: unique symbol;
27
+ export declare const _Hump: unique symbol;
28
+ export declare const _GlobalSqlOption: unique symbol;
29
+ export declare const _EventBus: unique symbol;
30
+ export declare const _path: unique symbol;
31
+ export declare const _fs: unique symbol;
32
+ export declare const logger: import("pino").Logger<never>;
19
33
  export declare enum DBType {
20
34
  Mysql = 0,
21
35
  Sqlite = 1,
@@ -24,6 +38,12 @@ export declare enum DBType {
24
38
  Redis = 4,
25
39
  RedisLock = 5
26
40
  }
41
+ export declare enum MapperIfUndefined {
42
+ Null = 0,
43
+ Skip = 1,
44
+ Zero = 2,
45
+ EmptyString = 3
46
+ }
27
47
  export declare enum SyncMode {
28
48
  /** 同步执行 */
29
49
  Sync = 0,
@@ -85,16 +105,28 @@ export declare enum TemplateResult {
85
105
  NotSureOne = 1,
86
106
  /** 返回多条记录 */
87
107
  Many = 2,
108
+ /** 返回多条记录并封装ArrayList */
109
+ ManyList = 3,
88
110
  /** 仅查询记录数量 */
89
- Count = 3
111
+ Count = 4
90
112
  }
91
113
  export declare enum SelectResult {
92
- One_Row_One_Column_Assert = 0,
93
- One_Row_One_Column_NotSure = 1,
94
- One_Row_Many_Column_Assert = 2,
95
- One_Row_Many_Column_NotSure = 3,
96
- Many_Row_One_Column = 4,
97
- Many_Row_Many_Column = 5
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
98
130
  }
99
131
  export declare enum SqlType {
100
132
  tinyint = 0,
@@ -132,6 +164,10 @@ export declare enum SqlType {
132
164
  multipolygon = 32,
133
165
  geometrycollection = 33
134
166
  }
167
+ export declare enum ColumnMode {
168
+ NONE = 0,
169
+ HUMP = 1
170
+ }
135
171
  export declare const SqliteMemory = ":memory:";
136
172
  interface MethodOption {
137
173
  tableName?: string;
@@ -144,6 +180,12 @@ interface MethodOption {
144
180
  /** 调用时,仅在开启事务时需要主动传入,传入方式: */
145
181
  conn?: Connection | null;
146
182
  }
183
+ export declare const _defOption: {
184
+ maxDeal: number;
185
+ skipUndefined: boolean;
186
+ skipNull: boolean;
187
+ skipEmptyString: boolean;
188
+ };
147
189
  /**
148
190
  数据服务注解
149
191
  */
@@ -184,7 +226,7 @@ interface ServiceOption {
184
226
  ```
185
227
  可以继承该接口来约束格式
186
228
  */
187
- interface GlobalSqlOption {
229
+ export interface GlobalSqlOptionForWeb {
188
230
  /** 增改忽略Undefined */
189
231
  skipUndefined?: boolean;
190
232
  /** 增改忽略NULL */
@@ -193,6 +235,59 @@ interface GlobalSqlOption {
193
235
  skipEmptyString?: boolean;
194
236
  /** 批量增改时,每次执行最多处理的记录数量 */
195
237
  maxDeal?: number;
238
+ SqliteRemote?: {
239
+ /**
240
+ ## 单一数据源
241
+ ```
242
+ db: 'd:/1.db'
243
+ ```
244
+ ## 多数据源:传入多个Mysql2的连接配置
245
+ ```
246
+ db: {
247
+ db1: 'd:/1.db',
248
+ db2: 'd:/2.db'
249
+ }
250
+ ```
251
+ 不支持 `SqliteMemory`
252
+ */
253
+ db: Record<string, string> | string;
254
+ /** 远程SQLITE接口实现,适用于Electron, 采用Ipc 的handel机制实现 */
255
+ service: SqliteRemoteInterface;
256
+ };
257
+ /** 日志等级 */
258
+ log?: 'trace' | 'debug' | 'info' | 'warn';
259
+ /**
260
+ 作用与sqlDir类似,不同在于sqlMap`不需要`目录,而是直接指定一个sqlModel对象,对象的格式和sqlDir的文件内容一样。
261
+ ** 适用于简单使用
262
+ */
263
+ sqlMap?: _SqlModel;
264
+ /**
265
+ 作用与sqlFnDir类似,不同在于sqlFNMap`不需要`目录,而是直接指定一个 Record<string, string>,对象的格式和sqlFnDir的文件内容一样。
266
+ ** 适用于简单使用
267
+ */
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;
277
+ }
278
+ /**
279
+ # 全局行为配置文件
280
+ MYSQL编码: 'utf8mb4', utf8mb4_general_ci'
281
+ ### `sqlDir?: string;` 数据库查询语句存放目录.存放格式为 export.default 的js、ts, 存放内容满足格式:
282
+
283
+ ```
284
+ interface SqlModel {
285
+ [key: string]: string | ((params: { [k: string]: any }, context: any, isCount?: boolean) => string)
286
+ }
287
+ ```
288
+ 可以继承该接口来约束格式
289
+ */
290
+ export interface GlobalSqlOption extends GlobalSqlOptionForWeb {
196
291
  /**
197
292
  初始化MYSQL链接 支持多数据源
198
293
  ## 单一数据源: 直接传入Mysql2的连接配置
@@ -234,27 +329,6 @@ interface GlobalSqlOption {
234
329
  路径 = `SqliteMemory` 将创建内存库
235
330
  */
236
331
  Sqlite?: Record<string, string> | string;
237
- SqliteRemote?: {
238
- /**
239
- ## 单一数据源
240
- ```
241
- db: 'd:/1.db'
242
- ```
243
- ## 多数据源:传入多个Mysql2的连接配置
244
- ```
245
- db: {
246
- db1: 'd:/1.db',
247
- db2: 'd:/2.db'
248
- }
249
- ```
250
- 不支持 `SqliteMemory`
251
- */
252
- db: Record<string, string> | string;
253
- /** 远程SQLITE接口实现,适用于Electron, 采用Ipc 的handel机制实现 */
254
- service: SqliteRemoteInterface;
255
- };
256
- /** 日志等级 */
257
- log?: 'trace' | 'debug' | 'info' | 'warn';
258
332
  /**
259
333
  ## 日志文件存放路径,该目录下文件名是模块名,例如有一个文件名为 `user.js`,内容为:
260
334
  ```
@@ -287,21 +361,26 @@ interface GlobalSqlOption {
287
361
  ## 也支持.mu文件,格式略
288
362
  */
289
363
  sqlDir?: string;
290
- /**
291
- 作用与sqlDir类似,不同在于sqlMap`不需要`目录,而是直接指定一个sqlModel对象,对象的格式和sqlDir的文件内容一样。
292
- ** 适用于简单使用
293
- */
294
- sqlMap?: SqlModel;
295
364
  /**
296
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)
297
- ** 文件名就是模板名
366
+ ## 文件名就是模板名
298
367
  */
299
368
  sqlFNDir?: string;
300
369
  /**
301
- 作用与sqlFnDir类似,不同在于sqlFNMap`不需要`目录,而是直接指定一个 Record<string, string>,对象的格式和sqlFnDir的文件内容一样。
302
- ** 适用于简单使用
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
+ ```
303
382
  */
304
- sqlFNMap?: Record<string, string>;
383
+ sqlMapperDir?: string;
305
384
  /**
306
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)
307
386
  ```
@@ -326,17 +405,61 @@ interface GlobalSqlOption {
326
405
  ```
327
406
  */
328
407
  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
+ /**
424
+ * 读取查询语句时,是否扫描JS文件?
425
+ * JS文件需要默认导出一个 SqlModel对象
426
+ */
427
+ jsMode?: boolean;
329
428
  }
330
429
  interface FieldOption extends Object {
331
430
  type?: SqlType;
332
- name?: string;
431
+ /** @deprecated 属性名称:TS注解不需要,JS手动注入需要 */
432
+ P?: string;
333
433
  length?: number;
334
434
  scale?: number;
335
435
  def?: any;
336
436
  index?: boolean;
337
437
  id?: boolean;
338
- logicDelete?: string;
438
+ logicDelete?: string | number;
439
+ /** 仅在生成 表时有效 */
339
440
  notNull?: boolean;
441
+ comment?: string;
442
+ /** sqlite 无效,与UUID只能有一个 */
443
+ uuidShort?: boolean;
444
+ /** 与uuidShort只能有一个 */
445
+ uuid?: boolean;
446
+ }
447
+ interface AField extends FieldOption {
448
+ /** 安全列名 */
449
+ C2: () => string;
450
+ /** @deprecated 数据列名称 */
451
+ C?: () => string;
452
+ /** 查询用:b_id bId */
453
+ C3: () => string;
454
+ [DBType.Mysql]: () => string;
455
+ [DBType.Sqlite]: () => string;
456
+ [DBType.SqliteRemote]: () => string;
457
+ }
458
+ export interface PageQuery<L> {
459
+ sum?: Record<string, number>;
460
+ total?: number;
461
+ size?: number;
462
+ records?: L[];
340
463
  }
341
464
  /** sqlite electron服务端需要支持的接口 */
342
465
  export interface SqliteRemoteInterface {
@@ -344,13 +467,13 @@ export interface SqliteRemoteInterface {
344
467
  affectedRows: number;
345
468
  insertId: bigint;
346
469
  }>;
347
- pluck<One_Row_Many_Column = any>(dbName: string, sql?: string, params?: any): Promise<One_Row_Many_Column | undefined>;
348
- get<One_Row_Many_Column = any>(dbName: string, sql?: string, params?: any): Promise<One_Row_Many_Column | undefined>;
470
+ pluck<One_Row_Many_Column = any>(dbName: string, sql?: string, params?: any): Promise<One_Row_Many_Column | null>;
471
+ get<One_Row_Many_Column = any>(dbName: string, sql?: string, params?: any): Promise<One_Row_Many_Column | null>;
349
472
  raw<Many_Row_One_Column = any>(dbName: string, sql?: string, params?: any): Promise<Many_Row_One_Column[]>;
350
473
  query<Many_Row_Many_Column = any>(dbName: string, sql?: string, params?: any): Promise<Many_Row_Many_Column[]>;
351
474
  initDB(dbName: string): Promise<void>;
352
- backup(dbName: string, name: string): Promise<void>;
353
- restore(dbName: string, name: string): Promise<void>;
475
+ export(dbName: string): Promise<void>;
476
+ restore(dbName: string, fromName: string): Promise<void>;
354
477
  }
355
478
  interface Connection {
356
479
  [_daoConnection]: any;
@@ -393,6 +516,81 @@ interface Dao {
393
516
  restore(sync: SyncMode.Sync, name: string): void;
394
517
  restore(sync: SyncMode.Async, name: string): Promise<void>;
395
518
  }
519
+ export declare class Mysql implements Dao {
520
+ [_daoDB]: any;
521
+ constructor(pool: any);
522
+ createConnection(sync: SyncMode.Sync): Connection | null;
523
+ createConnection(sync: SyncMode.Async): Promise<Connection | null>;
524
+ transaction<T = any>(sync: SyncMode.Sync, fn: (conn: Connection) => T, conn?: Connection | null): T | null;
525
+ transaction<T = any>(sync: SyncMode.Async, fn: (conn: Connection) => Promise<T>, conn?: Connection | null): Promise<T | null>;
526
+ close(sync: SyncMode.Sync): void;
527
+ close(sync: SyncMode.Async): Promise<void>;
528
+ backup(sync: SyncMode.Sync, name: string): void;
529
+ backup(sync: SyncMode.Async, name: string): Promise<void>;
530
+ remove(sync: SyncMode.Sync): void;
531
+ remove(sync: SyncMode.Async): Promise<void>;
532
+ restore(sync: SyncMode.Sync, name: string): void;
533
+ restore(sync: SyncMode.Async, name: string): Promise<void>;
534
+ }
535
+ export declare class Sqlite implements Dao {
536
+ [_daoDB]: any;
537
+ constructor(db: any);
538
+ createConnection(sync: SyncMode.Sync): Connection | null;
539
+ createConnection(sync: SyncMode.Async): Promise<Connection | null>;
540
+ transaction<T = any>(sync: SyncMode.Sync, fn: (conn: Connection) => T, conn?: Connection | null): T | null;
541
+ transaction<T = any>(sync: SyncMode.Async, fn: (conn: Connection) => Promise<T>, conn?: Connection | null): Promise<T | null>;
542
+ close(sync: SyncMode.Sync): void;
543
+ close(sync: SyncMode.Async): Promise<void>;
544
+ backup(sync: SyncMode.Sync, name: string): void;
545
+ backup(sync: SyncMode.Async, name: string): Promise<void>;
546
+ remove(sync: SyncMode.Sync): void;
547
+ remove(sync: SyncMode.Async): Promise<void>;
548
+ restore(sync: SyncMode.Sync, name: string): void;
549
+ restore(sync: SyncMode.Async, name: string): Promise<void>;
550
+ }
551
+ export declare class SqliteRemoteConnection implements Connection {
552
+ [_daoConnection]: SqliteRemoteInterface;
553
+ [_sqliteRemoteName]: string;
554
+ [_inTransaction]: boolean;
555
+ constructor(conn: SqliteRemoteInterface, name: string);
556
+ execute(sync: SyncMode.Sync, sql?: string, params?: any): {
557
+ affectedRows: number;
558
+ insertId: bigint;
559
+ };
560
+ execute(sync: SyncMode.Async, sql?: string, params?: any): Promise<{
561
+ affectedRows: number;
562
+ insertId: bigint;
563
+ }>;
564
+ pluck<T = any>(sync: SyncMode.Sync, sql?: string, params?: any): T | null;
565
+ pluck<T = any>(sync: SyncMode.Async, sql?: string, params?: any): Promise<T | null>;
566
+ get<T = any>(sync: SyncMode.Sync, sql?: string, params?: any): T | null;
567
+ get<T = any>(sync: SyncMode.Async, sql?: string, params?: any): Promise<T | null>;
568
+ raw<T = any>(sync: SyncMode.Sync, sql?: string, params?: any): T[];
569
+ raw<T = any>(sync: SyncMode.Async, sql?: string, params?: any): Promise<T[]>;
570
+ query<T = any>(sync: SyncMode.Sync, sql?: string, params?: any): T[];
571
+ query<T = any>(sync: SyncMode.Async, sql?: string, params?: any): Promise<T[]>;
572
+ realse(sync: SyncMode.Sync): void;
573
+ realse(sync: SyncMode.Async): Promise<void>;
574
+ }
575
+ export declare class SqliteRemote implements Dao {
576
+ [_sqliteRemoteName]: string;
577
+ [_daoDB]: SqliteRemoteInterface;
578
+ constructor(db: SqliteRemoteInterface, name: string);
579
+ createConnection(sync: SyncMode.Sync): Connection | null;
580
+ createConnection(sync: SyncMode.Async): Promise<Connection | null>;
581
+ transaction<T = any>(sync: SyncMode.Sync, fn: (conn: Connection) => T, conn?: Connection | null): T | null;
582
+ transaction<T = any>(sync: SyncMode.Async, fn: (conn: Connection) => Promise<T>, conn?: Connection | null): Promise<T | null>;
583
+ close(sync: SyncMode.Sync): void;
584
+ close(sync: SyncMode.Async): Promise<void>;
585
+ backup(sync: SyncMode.Sync, name: string): void;
586
+ backup(sync: SyncMode.Async, name: string): Promise<void>;
587
+ remove(sync: SyncMode.Sync): void;
588
+ remove(sync: SyncMode.Async): Promise<void>;
589
+ restore(sync: SyncMode.Sync, name: string): void;
590
+ restore(sync: SyncMode.Async, name: string): Promise<void>;
591
+ }
592
+ export type SqlMapper = ([string, string[], any?])[];
593
+ export type SqlMappers = Record<string, SqlMapper>;
396
594
  export type SqlModel = Record<string, string | ((options: {
397
595
  ctx: any;
398
596
  isCount?: boolean;
@@ -402,10 +600,68 @@ export type SqlModel = Record<string, string | ((options: {
402
600
  orderBy?: string;
403
601
  [k: string]: any;
404
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;
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;
620
+ export declare class SqlCache {
621
+ private sqlMap;
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;
637
+ init(options: {
638
+ sqlMap?: _SqlModel;
639
+ sqlDir?: string;
640
+ sqlFNMap?: Record<string, string>;
641
+ sqlFNDir?: string;
642
+ sqlMapperMap?: SqlMappers;
643
+ sqlMapperDir?: string;
644
+ jsMode?: boolean;
645
+ }): Promise<void>;
646
+ load(sqlids: string[], options: {
647
+ ctx: any;
648
+ isCount?: boolean;
649
+ isSum?: boolean;
650
+ limitStart?: number;
651
+ limitEnd?: number;
652
+ orderBy?: string;
653
+ [k: string]: any;
654
+ }): string;
655
+ }
405
656
  export declare const Field: (config: FieldOption) => (object: object, propertyName: string) => void;
406
- export declare const DB: (config: ServiceOption) => <C extends new (...args: any[]) => {}>(constructor: C) => {
657
+ export declare const DB: (config: ServiceOption) => <C extends {
658
+ new (...args: any[]): {};
659
+ }>(constructor: C) => {
407
660
  new (...args: any[]): {
408
661
  [_tableName]: string | undefined;
662
+ [_className]: string | undefined;
663
+ [_ClassName]: string | undefined;
664
+ [_vueName]: string | undefined;
409
665
  [_daoDBName]: string | undefined;
410
666
  [_dbType]: DBType;
411
667
  [_sqlite_version]: string | undefined;
@@ -426,8 +682,11 @@ export declare const DB: (config: ServiceOption) => <C extends new (...args: any
426
682
  [_transformer]: <L extends Object>(data: L, option?: MethodOption & {
427
683
  finalColumns?: Set<string>;
428
684
  tempColumns?: Array<string>;
429
- def?: boolean;
685
+ insert?: boolean;
430
686
  skipId?: boolean;
687
+ skipNull?: boolean;
688
+ skipUndefined?: boolean;
689
+ skipEmptyString?: boolean;
431
690
  onFieldExists?: (K: string, V: any) => void;
432
691
  }) => any;
433
692
  };
@@ -470,6 +729,9 @@ export declare function DeclareService(clz: any, config: ServiceOption): any;
470
729
  */
471
730
  export declare class SqlService<T extends object> {
472
731
  private [_tableName]?;
732
+ private [_className]?;
733
+ private [_ClassName]?;
734
+ private [_vueName]?;
473
735
  private [_daoDBName]?;
474
736
  private [_ids]?;
475
737
  private [_fields]?;
@@ -482,7 +744,15 @@ export declare class SqlService<T extends object> {
482
744
  private [_sqlite_version]?;
483
745
  private [_index]?;
484
746
  private [_def]?;
485
- private [_transformer]?;
747
+ [_transformer]?: <L = T>(data: Partial<L>, option?: MethodOption & {
748
+ finalColumns?: Set<string>;
749
+ insert?: boolean;
750
+ skipId?: boolean;
751
+ skipNull?: boolean;
752
+ skipUndefined?: boolean;
753
+ skipEmptyString?: boolean;
754
+ onFieldExists?: (K: string, V: any) => void;
755
+ }) => Partial<T>;
486
756
  private _insert;
487
757
  /**
488
758
  0. `sync`: 同步(sqlite)或者异步(mysql、remote),影响返回值类型,默认 `异步`
@@ -505,6 +775,7 @@ export declare class SqlService<T extends object> {
505
775
  2. `insertIfNotExists`: 通过主键或者existConditionOtherThanIds字段判断数据是否存在,不存在才插入,存在则不执行
506
776
  3. `replace`: 只支持用主键判断, 存在更新, 不存在插入
507
777
  11. `existConditionOtherThanIds`: insertIfNotExists时判断同一记录的字段名称,默认情况下按照ID判断,设置existConditionOtherThanIds后,不用id
778
+ 12. `replaceWithDef` replace时,是否带入默认值? 默认true
508
779
  ### 返回值是最后一次插入的主键ID,对于自增ID表适用
509
780
  1. 如果主键是自增批量操作,且期望返回所有记录的ID,那么需要设置 `option 中的 every = true`,此时效率降低
510
781
  * @param {{[P in keyof T]?: T[P]}} data
@@ -522,6 +793,7 @@ export declare class SqlService<T extends object> {
522
793
  skipNull?: boolean;
523
794
  skipEmptyString?: boolean;
524
795
  maxDeal?: number;
796
+ replaceWithDef?: boolean;
525
797
  }): Promise<bigint>;
526
798
  insert(option: MethodOption & {
527
799
  data: Partial<T>[];
@@ -534,6 +806,7 @@ export declare class SqlService<T extends object> {
534
806
  skipNull?: boolean;
535
807
  skipEmptyString?: boolean;
536
808
  maxDeal?: number;
809
+ replaceWithDef?: boolean;
537
810
  }): Promise<bigint[]>;
538
811
  insert(option: MethodOption & {
539
812
  data: Partial<T>;
@@ -546,6 +819,7 @@ export declare class SqlService<T extends object> {
546
819
  skipNull?: boolean;
547
820
  skipEmptyString?: boolean;
548
821
  maxDeal?: number;
822
+ replaceWithDef?: boolean;
549
823
  }): bigint;
550
824
  insert(option: MethodOption & {
551
825
  data: Partial<T>[];
@@ -558,6 +832,7 @@ export declare class SqlService<T extends object> {
558
832
  skipNull?: boolean;
559
833
  skipEmptyString?: boolean;
560
834
  maxDeal?: number;
835
+ replaceWithDef?: boolean;
561
836
  }): bigint[];
562
837
  private _update;
563
838
  /**
@@ -650,128 +925,143 @@ export declare class SqlService<T extends object> {
650
925
  8. `dao`: 永远不需要传入该值
651
926
 
652
927
  */
653
- template(option: MethodOption & {
654
- templateResult?: TemplateResult.AssertOne;
655
- id?: string | number | Array<string | number>;
656
- where?: Partial<T> | Array<Partial<T>>;
657
- mode?: SelectMode;
658
- error?: string;
659
- columns?: (keyof T)[];
660
- }): Promise<T>;
661
- template(option: MethodOption & {
928
+ template<L = T>(option: MethodOption & {
662
929
  sync: SyncMode.Sync;
663
930
  templateResult?: TemplateResult.AssertOne;
664
931
  id?: string | number | Array<string | number>;
665
- where?: Partial<T> | Array<Partial<T>>;
932
+ where?: Partial<L> | Array<Partial<L>>;
933
+ skipUndefined?: boolean;
934
+ skipNull?: boolean;
935
+ skipEmptyString?: boolean;
666
936
  mode?: SelectMode;
667
937
  error?: string;
668
- columns?: (keyof T)[];
669
- }): T;
670
- template(option: MethodOption & {
671
- sync: SyncMode.Async;
938
+ columns?: (keyof L)[];
939
+ }): L;
940
+ template<L = T>(option: MethodOption & {
941
+ sync?: SyncMode.Async;
672
942
  templateResult?: TemplateResult.AssertOne;
673
943
  id?: string | number | Array<string | number>;
674
- where?: Partial<T> | Array<Partial<T>>;
675
- mode?: SelectMode;
676
- error?: string;
677
- columns?: (keyof T)[];
678
- }): Promise<T>;
679
- template(option: MethodOption & {
680
- templateResult: TemplateResult.Count;
681
- id?: string | number | Array<string | number>;
682
- where?: Partial<T> | Array<Partial<T>>;
944
+ where?: Partial<L> | Array<Partial<L>>;
945
+ skipUndefined?: boolean;
946
+ skipNull?: boolean;
947
+ skipEmptyString?: boolean;
683
948
  mode?: SelectMode;
684
949
  error?: string;
685
- columns?: (keyof T)[];
686
- }): Promise<number>;
687
- template(option: MethodOption & {
950
+ columns?: (keyof L)[];
951
+ }): Promise<L>;
952
+ template<L = T>(option: MethodOption & {
688
953
  sync: SyncMode.Sync;
689
954
  templateResult: TemplateResult.Count;
690
955
  id?: string | number | Array<string | number>;
691
- where?: Partial<T> | Array<Partial<T>>;
956
+ where?: Partial<L> | Array<Partial<L>>;
957
+ skipUndefined?: boolean;
958
+ skipNull?: boolean;
959
+ skipEmptyString?: boolean;
692
960
  mode?: SelectMode;
693
961
  error?: string;
694
- columns?: (keyof T)[];
962
+ columns?: (keyof L)[];
695
963
  }): number;
696
- template(option: MethodOption & {
697
- sync: SyncMode.Async;
964
+ template<L = T>(option: MethodOption & {
965
+ sync?: SyncMode.Async;
698
966
  templateResult: TemplateResult.Count;
699
967
  id?: string | number | Array<string | number>;
700
- where?: Partial<T> | Array<Partial<T>>;
968
+ where?: Partial<L> | Array<Partial<L>>;
969
+ skipUndefined?: boolean;
970
+ skipNull?: boolean;
971
+ skipEmptyString?: boolean;
701
972
  mode?: SelectMode;
702
973
  error?: string;
703
- columns?: (keyof T)[];
974
+ columns?: (keyof L)[];
704
975
  }): Promise<number>;
705
- template(option: MethodOption & {
976
+ template<L = T>(option: MethodOption & {
977
+ sync: SyncMode.Sync;
706
978
  templateResult: TemplateResult.NotSureOne;
707
979
  id?: string | number | Array<string | number>;
708
- where?: Partial<T> | Array<Partial<T>>;
980
+ where?: Partial<L> | Array<Partial<L>>;
981
+ skipUndefined?: boolean;
982
+ skipNull?: boolean;
983
+ skipEmptyString?: boolean;
709
984
  mode?: SelectMode;
710
985
  error?: string;
711
- columns?: (keyof T)[];
712
- }): Promise<T | null>;
713
- template(option: MethodOption & {
714
- sync: SyncMode.Sync;
986
+ columns?: (keyof L)[];
987
+ }): L | null;
988
+ template<L = T>(option: MethodOption & {
989
+ sync?: SyncMode.Async;
715
990
  templateResult: TemplateResult.NotSureOne;
716
991
  id?: string | number | Array<string | number>;
717
- where?: Partial<T> | Array<Partial<T>>;
992
+ where?: Partial<L> | Array<Partial<L>>;
993
+ skipUndefined?: boolean;
994
+ skipNull?: boolean;
995
+ skipEmptyString?: boolean;
718
996
  mode?: SelectMode;
719
997
  error?: string;
720
- columns?: (keyof T)[];
721
- }): T | null;
722
- template(option: MethodOption & {
723
- sync: SyncMode.Async;
724
- templateResult: TemplateResult.NotSureOne;
998
+ columns?: (keyof L)[];
999
+ }): Promise<L | null>;
1000
+ template<L = T>(option: MethodOption & {
1001
+ sync: SyncMode.Sync;
1002
+ templateResult: TemplateResult.Many;
725
1003
  id?: string | number | Array<string | number>;
726
- where?: Partial<T> | Array<Partial<T>>;
1004
+ where?: Partial<L> | Array<Partial<L>>;
1005
+ skipUndefined?: boolean;
1006
+ skipNull?: boolean;
1007
+ skipEmptyString?: boolean;
727
1008
  mode?: SelectMode;
728
1009
  error?: string;
729
- columns?: (keyof T)[];
730
- }): Promise<T | null>;
731
- template(option: MethodOption & {
1010
+ columns?: (keyof L)[];
1011
+ }): L[];
1012
+ template<L = T>(option: MethodOption & {
1013
+ sync?: SyncMode.Async;
732
1014
  templateResult: TemplateResult.Many;
733
1015
  id?: string | number | Array<string | number>;
734
- where?: Partial<T> | Array<Partial<T>>;
1016
+ where?: Partial<L> | Array<Partial<L>>;
1017
+ skipUndefined?: boolean;
1018
+ skipNull?: boolean;
1019
+ skipEmptyString?: boolean;
735
1020
  mode?: SelectMode;
736
1021
  error?: string;
737
- columns?: (keyof T)[];
738
- }): Promise<T[]>;
739
- template(option: MethodOption & {
1022
+ columns?: (keyof L)[];
1023
+ }): Promise<L[]>;
1024
+ template<L = T>(option: MethodOption & {
740
1025
  sync: SyncMode.Sync;
741
- templateResult: TemplateResult.Many;
1026
+ templateResult: TemplateResult.ManyList;
742
1027
  id?: string | number | Array<string | number>;
743
- where?: Partial<T> | Array<Partial<T>>;
1028
+ where?: Partial<L> | Array<Partial<L>>;
1029
+ skipUndefined?: boolean;
1030
+ skipNull?: boolean;
1031
+ skipEmptyString?: boolean;
744
1032
  mode?: SelectMode;
745
1033
  error?: string;
746
- columns?: (keyof T)[];
747
- }): T[];
748
- template(option: MethodOption & {
749
- sync: SyncMode.Async;
750
- templateResult: TemplateResult.Many;
1034
+ columns?: (keyof L)[];
1035
+ }): ArrayList<L>;
1036
+ template<L = T>(option: MethodOption & {
1037
+ sync?: SyncMode.Async;
1038
+ templateResult: TemplateResult.ManyList;
751
1039
  id?: string | number | Array<string | number>;
752
- where?: Partial<T> | Array<Partial<T>>;
1040
+ where?: Partial<L> | Array<Partial<L>>;
1041
+ skipUndefined?: boolean;
1042
+ skipNull?: boolean;
1043
+ skipEmptyString?: boolean;
753
1044
  mode?: SelectMode;
754
1045
  error?: string;
755
- columns?: (keyof T)[];
756
- }): Promise<T[]>;
1046
+ columns?: (keyof L)[];
1047
+ }): Promise<ArrayList<L>>;
757
1048
  private _select;
758
1049
  /**
759
1050
  # 自由查询
760
1051
  0. `sync`: 同步(sqlite)或者异步(mysql、remote),影响返回值类型,默认`异步模式`
761
- 1. `templateResult`: 返回值类型断言,三种
762
- 1. One_Row_One_Column_Assert,
763
- 2. One_Row_One_Column_NotSure,
764
- 3. One_Row_Many_Column_Assert,
765
- 4. One_Row_Many_Column_NotSure,
766
- 5. Many_Row_One_Column,
767
- 6. Many_Row_Many_Column[默认]
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
768
1061
  2. `sql` 或者 `sqlid`
769
1062
  3. `params`
770
1063
  4. `defValue`: One_Row_One_Column 时有效
771
- 5. `multiple`: = true 时表示多重sql查询,且每个sql的结果都是相同的resultMode, 此时 `One_Row_One_Column` `Many_Row_One_Column` `One_Row_Many_Column` 将按多重数组解析,`Many_Row_Many_Column` 不变,此时需要自己手动指定返回类型.
772
- 此时 `One_Row_One_Column` 将返回多个单值组成的数组: `[1, 'ok', 3]`
773
- `One_Row_Many_Column` 将返回多个对象组成的数组: `[{ob1}, {ob2}, {ob3}]`
774
- `Many_Row_One_Column` 将返回多个单值数组组成的数组: `[[1,2,3], ['a', 'b']]`
1064
+ 5. 禁止一次查询多个语句
775
1065
  6. `dbName`: 默认使用service注解的`dbName`,可以在某个方法中覆盖
776
1066
  7. `conn`: 仅在开启事务时需要主动传入,传入示例:
777
1067
  ```
@@ -780,79 +1070,121 @@ export declare class SqlService<T extends object> {
780
1070
  });
781
1071
  ```
782
1072
  9. `dao`: 永远不需要传入该值
1073
+ 10. `hump`: 是否将列名改为驼峰写法?默认情况下按照全局配置
1074
+ 11. `mapper`: 列名-属性 映射工具,优先级高于hump
783
1075
 
784
1076
  */
785
1077
  select<L = T>(option: MethodOption & {
786
1078
  sync?: SyncMode.Async;
787
- selectResult?: SelectResult.Many_Row_Many_Column | SelectResult.Many_Row_One_Column;
1079
+ selectResult?: SelectResult.RS_CS | SelectResult.RS_C;
788
1080
  sqlId?: string;
789
1081
  sql?: string;
790
1082
  params?: Record<string, any>;
791
1083
  context?: any;
792
1084
  isCount?: boolean;
793
1085
  defValue?: L | null;
794
- multiple?: boolean;
795
1086
  errorMsg?: string;
1087
+ hump?: boolean;
1088
+ mapper?: string | SqlMapper;
1089
+ mapperIfUndefined?: MapperIfUndefined;
796
1090
  }): Promise<L[]>;
797
1091
  select<L = T>(option: MethodOption & {
798
1092
  sync?: SyncMode.Async;
799
- selectResult: SelectResult.One_Row_Many_Column_Assert | SelectResult.One_Row_One_Column_Assert;
1093
+ selectResult: SelectResult.RS_CS_List | SelectResult.RS_C_List;
800
1094
  sqlId?: string;
801
1095
  sql?: string;
802
1096
  params?: Record<string, any>;
803
1097
  context?: any;
804
1098
  isCount?: boolean;
805
1099
  defValue?: L | null;
806
- multiple?: boolean;
807
1100
  errorMsg?: string;
1101
+ hump?: boolean;
1102
+ mapper?: string | SqlMapper;
1103
+ mapperIfUndefined?: MapperIfUndefined;
1104
+ }): Promise<ArrayList<L>>;
1105
+ select<L = T>(option: MethodOption & {
1106
+ sync?: SyncMode.Async;
1107
+ selectResult: SelectResult.R_CS_Assert | SelectResult.R_C_Assert;
1108
+ sqlId?: string;
1109
+ sql?: string;
1110
+ params?: Record<string, any>;
1111
+ context?: any;
1112
+ isCount?: boolean;
1113
+ defValue?: L | null;
1114
+ errorMsg?: string;
1115
+ hump?: boolean;
1116
+ mapper?: string | SqlMapper;
1117
+ mapperIfUndefined?: MapperIfUndefined;
808
1118
  }): Promise<L>;
809
1119
  select<L = T>(option: MethodOption & {
810
1120
  sync?: SyncMode.Async;
811
- selectResult: SelectResult.One_Row_Many_Column_NotSure | SelectResult.One_Row_One_Column_NotSure;
1121
+ selectResult: SelectResult.R_CS_NotSure | SelectResult.R_C_NotSure;
812
1122
  sqlId?: string;
813
1123
  sql?: string;
814
1124
  params?: Record<string, any>;
815
1125
  context?: any;
816
1126
  isCount?: boolean;
817
1127
  defValue?: L | null;
818
- multiple?: boolean;
819
1128
  errorMsg?: string;
1129
+ hump?: boolean;
1130
+ mapper?: string | SqlMapper;
1131
+ mapperIfUndefined?: MapperIfUndefined;
820
1132
  }): Promise<L | null>;
821
1133
  select<L = T>(option: MethodOption & {
822
1134
  sync: SyncMode.Sync;
823
- selectResult?: SelectResult.Many_Row_Many_Column | SelectResult.Many_Row_One_Column;
1135
+ selectResult?: SelectResult.RS_CS | SelectResult.RS_C;
824
1136
  sqlId?: string;
825
1137
  sql?: string;
826
1138
  params?: Record<string, any>;
827
1139
  context?: any;
828
1140
  isCount?: boolean;
829
1141
  defValue?: L | null;
830
- multiple?: boolean;
831
1142
  errorMsg?: string;
1143
+ hump?: boolean;
1144
+ mapper?: string | SqlMapper;
1145
+ mapperIfUndefined?: MapperIfUndefined;
832
1146
  }): L[];
833
1147
  select<L = T>(option: MethodOption & {
834
1148
  sync: SyncMode.Sync;
835
- selectResult: SelectResult.One_Row_Many_Column_Assert | SelectResult.One_Row_One_Column_Assert;
1149
+ selectResult: SelectResult.RS_CS_List | SelectResult.RS_C_List;
836
1150
  sqlId?: string;
837
1151
  sql?: string;
838
1152
  params?: Record<string, any>;
839
1153
  context?: any;
840
1154
  isCount?: boolean;
841
1155
  defValue?: L | null;
842
- multiple?: boolean;
843
1156
  errorMsg?: string;
1157
+ hump?: boolean;
1158
+ mapper?: string | SqlMapper;
1159
+ mapperIfUndefined?: MapperIfUndefined;
1160
+ }): ArrayList<L>;
1161
+ select<L = T>(option: MethodOption & {
1162
+ sync: SyncMode.Sync;
1163
+ selectResult: SelectResult.R_CS_Assert | SelectResult.R_C_Assert;
1164
+ sqlId?: string;
1165
+ sql?: string;
1166
+ params?: Record<string, any>;
1167
+ context?: any;
1168
+ isCount?: boolean;
1169
+ defValue?: L | null;
1170
+ errorMsg?: string;
1171
+ hump?: boolean;
1172
+ mapper?: string | SqlMapper;
1173
+ mapperIfUndefined?: MapperIfUndefined;
844
1174
  }): L;
845
1175
  select<L = T>(option: MethodOption & {
846
1176
  sync: SyncMode.Sync;
847
- selectResult: SelectResult.One_Row_Many_Column_NotSure | SelectResult.One_Row_One_Column_NotSure;
1177
+ selectResult: SelectResult.R_CS_NotSure | SelectResult.R_C_NotSure;
848
1178
  sqlId?: string;
849
1179
  sql?: string;
850
1180
  params?: Record<string, any>;
851
1181
  context?: any;
852
1182
  isCount?: boolean;
853
1183
  defValue?: L | null;
854
- multiple?: boolean;
855
1184
  errorMsg?: string;
1185
+ hump?: boolean;
1186
+ mapper?: string | SqlMapper;
1187
+ mapperIfUndefined?: MapperIfUndefined;
856
1188
  }): L | null;
857
1189
  /**
858
1190
  # 自由执行sql
@@ -867,7 +1199,7 @@ export declare class SqlService<T extends object> {
867
1199
  });
868
1200
  ```
869
1201
  5. `dao`: 永远不需要传入该值
870
-
1202
+
871
1203
  */
872
1204
  excute<L = T>(option: MethodOption & {
873
1205
  sync?: SyncMode.Async;
@@ -908,7 +1240,37 @@ export declare class SqlService<T extends object> {
908
1240
  sync: SyncMode.Sync;
909
1241
  fn: (conn: Connection) => L;
910
1242
  }): L | null;
911
- stream(option?: MethodOption): StreamQuery<T>;
1243
+ stream<L extends object = T>(option?: MethodOption): StreamQuery<L>;
1244
+ page<L = T>(option: MethodOption & {
1245
+ sync?: SyncMode.Async;
1246
+ sqlId: string;
1247
+ context?: any;
1248
+ params: Record<string, any>;
1249
+ pageSize: number;
1250
+ pageNumber: number;
1251
+ limitSelf?: boolean;
1252
+ countSelf?: boolean;
1253
+ sumSelf?: boolean;
1254
+ orderBy?: string;
1255
+ hump?: boolean;
1256
+ mapper?: string | SqlMapper;
1257
+ mapperIfUndefined?: MapperIfUndefined;
1258
+ }): Promise<PageQuery<L>>;
1259
+ page<L = T>(option: MethodOption & {
1260
+ sync: SyncMode.Sync;
1261
+ sqlId: string;
1262
+ context?: any;
1263
+ params: Record<string, any>;
1264
+ pageSize: number;
1265
+ pageNumber: number;
1266
+ limitSelf?: boolean;
1267
+ countSelf?: boolean;
1268
+ sumSelf?: boolean;
1269
+ orderBy?: string;
1270
+ hump?: boolean;
1271
+ mapper?: string | SqlMapper;
1272
+ mapperIfUndefined?: MapperIfUndefined;
1273
+ }): PageQuery<L>;
912
1274
  /**
913
1275
  #创建表
914
1276
  ** `tableName` 表名称
@@ -922,223 +1284,266 @@ export declare class SqlService<T extends object> {
922
1284
  ** `index` 表的索引,设置方式同ID
923
1285
  */
924
1286
  private _createTable;
1287
+ private _matchSqlid;
925
1288
  }
926
- declare class StreamCondition<T extends object> {
927
- protected _prefix: number;
928
- protected _index: number;
929
- protected _wheres: string[];
930
- protected _andQuerys: StreamCondition<T>[];
931
- protected _orQuerys: StreamCondition<T>[];
932
- protected _paramKeys: Record<string, string[] | Record<string, string> | string>;
933
- protected _param: Record<string, any>;
1289
+ declare class StreamQuery<T extends object> {
1290
+ private _prefix;
1291
+ private _index;
1292
+ private _wheres;
1293
+ private _andQuerys;
1294
+ private _orQuerys;
1295
+ private _paramKeys;
1296
+ private _param;
934
1297
  if_proceed: boolean;
935
1298
  if_exec: boolean;
936
- constructor();
1299
+ private _table;
1300
+ private _distinct;
1301
+ private _columns;
1302
+ private _updates?;
1303
+ private _updateColumns;
1304
+ private _groups;
1305
+ private _orders;
1306
+ private _startRow;
1307
+ private _pageSize;
1308
+ private _service;
1309
+ private [_fields];
1310
+ private [_columns];
1311
+ constructor(table: string, service: SqlService<T>, __fields: Record<string, AField>, __columns: string[]);
937
1312
  /** 将当前stream重置 */
938
1313
  reset(): this;
939
1314
  /** 为下次链条执行提供条件判断:非异步方法跳过,异步方法不执行并返回默认值 */
940
1315
  if(condition: boolean): this;
941
- eq(key: keyof T, value: string | number, { name }?: {
942
- name?: string;
1316
+ eq(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1317
+ paramName?: string | undefined;
1318
+ skipEmptyString?: boolean | undefined;
1319
+ breakExcuteIfSkip?: boolean | undefined;
943
1320
  }): this;
944
- eqT(t: Partial<T>, { name }?: {
945
- name?: string;
1321
+ eqT(t: Partial<T>, { name: paramName, breakExcuteIfSkip }?: {
1322
+ name?: string | undefined;
1323
+ breakExcuteIfSkip?: boolean | undefined;
946
1324
  }): this;
947
- notEq(key: keyof T, value: string | number, { name }?: {
948
- name?: string;
1325
+ notEq(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1326
+ paramName?: string | undefined;
1327
+ skipEmptyString?: boolean | undefined;
1328
+ breakExcuteIfSkip?: boolean | undefined;
949
1329
  }): this;
950
1330
  eqWith(key1: keyof T, key2: keyof T): this;
951
1331
  notEqWith(key1: keyof T, key2: keyof T): this;
952
- regexp(key: keyof T, regexp: string, { name }?: {
953
- name?: string;
1332
+ regexp(key: keyof T, regexp: string, { paramName, breakExcuteIfSkip }?: {
1333
+ paramName?: string | undefined;
1334
+ breakExcuteIfSkip?: boolean | undefined;
954
1335
  }): this;
955
- notRegexp(key: keyof T, regexp: string, { name }?: {
956
- name?: string;
1336
+ notRegexp(key: keyof T, regexp: string, { paramName, breakExcuteIfSkip }?: {
1337
+ paramName?: string | undefined;
1338
+ breakExcuteIfSkip?: boolean | undefined;
957
1339
  }): this;
958
1340
  /** (key1 << 8) + key2 = value */
959
- shiftEq(key1: keyof T, key2: keyof T, value: number, { name }?: {
960
- name?: string;
1341
+ shiftEq(key1: keyof T, key2: keyof T, value: number, { paramName, breakExcuteIfSkip }?: {
1342
+ paramName?: string | undefined;
1343
+ breakExcuteIfSkip?: boolean | undefined;
961
1344
  }): this;
962
1345
  /** (key1 << 8) + key2 <> value */
963
- shiftNotEq(key1: keyof T, key2: keyof T, value: number, { name }?: {
964
- name?: string;
1346
+ shiftNotEq(key1: keyof T, key2: keyof T, value: number, { paramName, breakExcuteIfSkip }?: {
1347
+ paramName?: string | undefined;
1348
+ breakExcuteIfSkip?: boolean | undefined;
965
1349
  }): this;
966
- grate(key: keyof T, value: string | number, { name }?: {
967
- name?: string;
1350
+ grate(key: keyof T, value: string | number, { paramName, breakExcuteIfSkip }?: {
1351
+ paramName?: string | undefined;
1352
+ breakExcuteIfSkip?: boolean | undefined;
968
1353
  }): this;
969
- grateEq(key: keyof T, value: string | number, { name }?: {
970
- name?: string;
1354
+ grateEq(key: keyof T, value: string | number, { paramName, breakExcuteIfSkip }?: {
1355
+ paramName?: string | undefined;
1356
+ breakExcuteIfSkip?: boolean | undefined;
971
1357
  }): this;
972
1358
  grateWith(key1: keyof T, key2: keyof T): this;
973
1359
  grateEqWith(key1: keyof T, key2: keyof T): this;
974
- less(key: keyof T, value: string | number, { name }?: {
975
- name?: string;
1360
+ less(key: keyof T, value: string | number, { paramName, breakExcuteIfSkip }?: {
1361
+ paramName?: string | undefined;
1362
+ breakExcuteIfSkip?: boolean | undefined;
976
1363
  }): this;
977
- lessEq(key: keyof T, value: string | number, { name }?: {
978
- name?: string;
1364
+ lessEq(key: keyof T, value: string | number, { paramName, breakExcuteIfSkip }?: {
1365
+ paramName?: string | undefined;
1366
+ breakExcuteIfSkip?: boolean | undefined;
979
1367
  }): this;
980
1368
  lessWith(key1: keyof T, key2: keyof T): this;
981
1369
  lessEqWith(key1: keyof T, key2: keyof T): this;
982
- like(key: keyof T, value: string | number, { name, force }?: {
983
- name?: string;
984
- force?: boolean;
1370
+ like(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1371
+ paramName?: string | undefined;
1372
+ skipEmptyString?: boolean | undefined;
1373
+ breakExcuteIfSkip?: boolean | undefined;
985
1374
  }): this;
986
- notLike(key: keyof T, value: string | number, { name, force }?: {
987
- name?: string;
988
- force?: boolean;
1375
+ notLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1376
+ paramName?: string | undefined;
1377
+ skipEmptyString?: boolean | undefined;
1378
+ breakExcuteIfSkip?: boolean | undefined;
989
1379
  }): this;
990
- leftLike(key: keyof T, value: string | number, { name, force }?: {
991
- name?: string;
992
- force?: boolean;
1380
+ leftLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1381
+ paramName?: string | undefined;
1382
+ skipEmptyString?: boolean | undefined;
1383
+ breakExcuteIfSkip?: boolean | undefined;
993
1384
  }): this;
994
- notLeftLike(key: keyof T, value: string | number, { name, force }?: {
995
- name?: string;
996
- force?: boolean;
1385
+ notLeftLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1386
+ paramName?: string | undefined;
1387
+ skipEmptyString?: boolean | undefined;
1388
+ breakExcuteIfSkip?: boolean | undefined;
997
1389
  }): this;
998
- rightLike(key: keyof T, value: string | number, { name, force }?: {
999
- name?: string;
1000
- force?: boolean;
1390
+ rightLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1391
+ paramName?: string | undefined;
1392
+ skipEmptyString?: boolean | undefined;
1393
+ breakExcuteIfSkip?: boolean | undefined;
1001
1394
  }): this;
1002
- notRightLike(key: keyof T, value: string | number, { name, force }?: {
1003
- name?: string;
1004
- force?: boolean;
1395
+ notRightLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1396
+ paramName?: string | undefined;
1397
+ skipEmptyString?: boolean | undefined;
1398
+ breakExcuteIfSkip?: boolean | undefined;
1005
1399
  }): this;
1006
- PreciseLike(key: keyof T, value: string | number, { name, force }?: {
1007
- name?: string;
1008
- force?: boolean;
1400
+ PreciseLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1401
+ paramName?: string | undefined;
1402
+ skipEmptyString?: boolean | undefined;
1403
+ breakExcuteIfSkip?: boolean | undefined;
1009
1404
  }): this;
1010
- notPreciseLike(key: keyof T, value: string | number, { name, force }?: {
1011
- name?: string;
1012
- force?: boolean;
1405
+ notPreciseLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1406
+ paramName?: string | undefined;
1407
+ skipEmptyString?: boolean | undefined;
1408
+ breakExcuteIfSkip?: boolean | undefined;
1013
1409
  }): this;
1014
- glob(key: keyof T, value: string | number, { name, force }?: {
1015
- name?: string;
1016
- force?: boolean;
1410
+ glob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1411
+ paramName?: string | undefined;
1412
+ skipEmptyString?: boolean | undefined;
1413
+ breakExcuteIfSkip?: boolean | undefined;
1017
1414
  }): this;
1018
- notGlob(key: keyof T, value: string | number, { name, force }?: {
1019
- name?: string;
1020
- force?: boolean;
1415
+ notGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1416
+ paramName?: string | undefined;
1417
+ skipEmptyString?: boolean | undefined;
1418
+ breakExcuteIfSkip?: boolean | undefined;
1021
1419
  }): this;
1022
- leftGlob(key: keyof T, value: string | number, { name, force }?: {
1023
- name?: string;
1024
- force?: boolean;
1420
+ leftGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1421
+ paramName?: string | undefined;
1422
+ skipEmptyString?: boolean | undefined;
1423
+ breakExcuteIfSkip?: boolean | undefined;
1025
1424
  }): this;
1026
- notLeftGlob(key: keyof T, value: string | number, { name, force }?: {
1027
- name?: string;
1028
- force?: boolean;
1425
+ notLeftGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1426
+ paramName?: string | undefined;
1427
+ skipEmptyString?: boolean | undefined;
1428
+ breakExcuteIfSkip?: boolean | undefined;
1029
1429
  }): this;
1030
- rightGlob(key: keyof T, value: string | number, { name, force }?: {
1031
- name?: string;
1032
- force?: boolean;
1430
+ rightGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1431
+ paramName?: string | undefined;
1432
+ skipEmptyString?: boolean | undefined;
1433
+ breakExcuteIfSkip?: boolean | undefined;
1033
1434
  }): this;
1034
- notRightGlob(key: keyof T, value: string | number, { name, force }?: {
1035
- name?: string;
1036
- force?: boolean;
1435
+ notRightGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1436
+ paramName?: string | undefined;
1437
+ skipEmptyString?: boolean | undefined;
1438
+ breakExcuteIfSkip?: boolean | undefined;
1037
1439
  }): this;
1038
- PreciseGlob(key: keyof T, value: string | number, { name, force }?: {
1039
- name?: string;
1040
- force?: boolean;
1440
+ PreciseGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1441
+ paramName?: string | undefined;
1442
+ skipEmptyString?: boolean | undefined;
1443
+ breakExcuteIfSkip?: boolean | undefined;
1041
1444
  }): this;
1042
- notPreciseGlob(key: keyof T, value: string | number, { name, force }?: {
1043
- name?: string;
1044
- force?: boolean;
1445
+ notPreciseGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1446
+ paramName?: string | undefined;
1447
+ skipEmptyString?: boolean | undefined;
1448
+ breakExcuteIfSkip?: boolean | undefined;
1045
1449
  }): this;
1046
- in(key: keyof T, value: Array<string | number>, { name, force }?: {
1047
- name?: string;
1048
- force?: boolean;
1450
+ in(key: keyof T, value: Array<string | number>, { paramName, breakExcuteIfSkip }?: {
1451
+ paramName?: string | undefined;
1452
+ breakExcuteIfSkip?: boolean | undefined;
1049
1453
  }): this;
1050
- notIn(key: keyof T, value: Array<string | number>, { name, force }?: {
1051
- name?: string;
1052
- force?: boolean;
1454
+ notIn(key: keyof T, value: Array<string | number>, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1455
+ paramName?: string | undefined;
1456
+ skipEmptyString?: boolean | undefined;
1457
+ breakExcuteIfSkip?: boolean | undefined;
1053
1458
  }): this;
1054
1459
  isNULL(key: keyof T): this;
1055
1460
  isNotNULL(key: keyof T): this;
1056
- between(key: keyof T, value1: string | number, value2: string | number, { name }?: {
1057
- name?: string;
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;
1058
1465
  }): this;
1059
- notBetween(key: keyof T, value1: string | number, value2: string | number, { name }?: {
1060
- name?: string;
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;
1061
1470
  }): this;
1062
- pow(key: keyof T, value: number, { name }?: {
1063
- name?: string;
1471
+ pow(key: keyof T, value: number, { paramName, breakExcuteIfSkip }?: {
1472
+ paramName?: string | undefined;
1473
+ breakExcuteIfSkip?: boolean | undefined;
1064
1474
  }): this;
1065
- notPow(key: keyof T, value: number, { name }?: {
1066
- name?: string;
1475
+ notPow(key: keyof T, value: number, { paramName, breakExcuteIfSkip }?: {
1476
+ paramName?: string | undefined;
1477
+ breakExcuteIfSkip?: boolean | undefined;
1067
1478
  }): this;
1068
- powWith(key: keyof T, values: Array<number | string>, { name }?: {
1069
- name?: string;
1479
+ powWith(key: keyof T, values: Array<number | string>, { paramName, breakExcuteIfSkip }?: {
1480
+ paramName?: string | undefined;
1481
+ breakExcuteIfSkip?: boolean | undefined;
1070
1482
  }): this;
1071
- notPowWith(key: keyof T, values: Array<number | string>, { name }?: {
1072
- name?: string;
1483
+ notPowWith(key: keyof T, values: Array<number | string>, { paramName, breakExcuteIfSkip }?: {
1484
+ paramName?: string | undefined;
1485
+ breakExcuteIfSkip?: boolean | undefined;
1073
1486
  }): this;
1074
1487
  /** MATCH(key1, key2, key3) AGAINST (value) */
1075
- match(value: string, keys: (keyof T)[], { name }?: {
1076
- name?: string;
1488
+ match(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1489
+ paramName?: string | undefined;
1490
+ skipEmptyString?: boolean | undefined;
1491
+ breakExcuteIfSkip?: boolean | undefined;
1077
1492
  }): this;
1078
1493
  /** NOT MATCH(key1, key2, key3) AGAINST (value) */
1079
- notMatch(value: string, keys: (keyof T)[], { name }?: {
1080
- name?: string;
1494
+ notMatch(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1495
+ paramName?: string | undefined;
1496
+ skipEmptyString?: boolean | undefined;
1497
+ breakExcuteIfSkip?: boolean | undefined;
1081
1498
  }): this;
1082
1499
  /** MATCH(key1, key2, key3) AGAINST (value) IN BOOLEAN MODE*/
1083
- matchBoolean(value: string, keys: (keyof T)[], { name }?: {
1084
- name?: string;
1500
+ matchBoolean(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1501
+ paramName?: string | undefined;
1502
+ skipEmptyString?: boolean | undefined;
1503
+ breakExcuteIfSkip?: boolean | undefined;
1085
1504
  }): this;
1086
1505
  /** NOT MATCH(key1, key2, key3) AGAINST (value) IN BOOLEAN MODE */
1087
- notMatchBoolean(value: string, keys: (keyof T)[], { name }?: {
1088
- name?: string;
1506
+ notMatchBoolean(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1507
+ paramName?: string | undefined;
1508
+ skipEmptyString?: boolean | undefined;
1509
+ breakExcuteIfSkip?: boolean | undefined;
1089
1510
  }): this;
1090
1511
  /** MATCH(key1, key2, key3) AGAINST (value) WITH QUERY EXPANSION*/
1091
- matchQuery(value: string, keys: (keyof T)[], { name }?: {
1092
- name?: string;
1512
+ matchQuery(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1513
+ paramName?: string | undefined;
1514
+ skipEmptyString?: boolean | undefined;
1515
+ breakExcuteIfSkip?: boolean | undefined;
1093
1516
  }): this;
1094
1517
  /** NOT MATCH(key1, key2, key3) AGAINST (value) WITH QUERY EXPANSION*/
1095
- notMatchQuery(value: string, keys: (keyof T)[], { name }?: {
1096
- name?: string;
1518
+ notMatchQuery(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1519
+ paramName?: string | undefined;
1520
+ skipEmptyString?: boolean | undefined;
1521
+ breakExcuteIfSkip?: boolean | undefined;
1097
1522
  }): this;
1098
- includes(key: keyof T, value: string | number, { name }?: {
1099
- name?: string;
1523
+ includes(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1524
+ paramName?: string | undefined;
1525
+ skipEmptyString?: boolean | undefined;
1526
+ breakExcuteIfSkip?: boolean | undefined;
1100
1527
  }): this;
1101
- notIncludes(key: keyof T, value: string | number, { name }?: {
1102
- name?: string;
1528
+ notIncludes(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfSkip }?: {
1529
+ paramName?: string | undefined;
1530
+ skipEmptyString?: boolean | undefined;
1531
+ breakExcuteIfSkip?: boolean | undefined;
1103
1532
  }): this;
1104
- and(fn: (stream: StreamCondition<T>) => boolean | void): this;
1105
- or(fn: (stream: StreamCondition<T>) => boolean | void): this;
1106
- protected where(): {
1107
- where: string;
1108
- params: Record<string, any>;
1109
- };
1110
- private _;
1111
- private _null;
1112
- private _key;
1113
- private _between;
1114
- private _in;
1115
- private _shift;
1116
- private _match;
1117
- private _pow;
1118
- private _like;
1119
- private _includes;
1120
- }
1121
- declare class StreamBuild<T extends object> extends StreamCondition<T> {
1122
- protected _table: string;
1123
- protected _distinct: boolean;
1124
- protected _columns: string[];
1125
- protected _updates?: Partial<T>;
1126
- protected _updateColumns: string[];
1127
- protected _groups: (keyof T)[];
1128
- protected _orders: string[];
1129
- protected _startRow: number;
1130
- protected _pageSize: number;
1131
- constructor(table: string);
1132
- /** 将当前stream重置 */
1133
- reset(): this;
1134
- groupBy(key: keyof T): this;
1533
+ and(fn: StreamQuery<T> | ((stream: StreamQuery<T>) => boolean | void)): this;
1534
+ or(fn: StreamQuery<T> | ((stream: StreamQuery<T>) => boolean | void)): this;
1535
+ groupBy(...keys: (keyof T)[]): this;
1536
+ groupBy2(...keys: string[]): this;
1135
1537
  asc(...keys: (keyof T)[]): this;
1538
+ asc2(...keys: string[]): this;
1136
1539
  desc(...keys: (keyof T)[]): this;
1540
+ desc2(...keys: string[]): this;
1137
1541
  limit(startRow: number, pageSize: number): this;
1138
1542
  page(pageNumber: number, pageSize: number): this;
1139
1543
  table(_table: string): this;
1140
1544
  distinct(on?: boolean): this;
1141
- count(key: keyof T, countName?: string, distinct?: boolean): this;
1545
+ countDistinct(key: keyof T, countName?: string): this;
1546
+ count(countName?: string): this;
1142
1547
  sum(key: keyof T, legName?: string, distinct?: boolean): this;
1143
1548
  avg(key: keyof T, legName?: string, distinct?: boolean): this;
1144
1549
  max(key: keyof T, legName?: string, distinct?: boolean): this;
@@ -1150,60 +1555,111 @@ declare class StreamBuild<T extends object> extends StreamCondition<T> {
1150
1555
  desc?: (keyof T)[];
1151
1556
  groupName?: string;
1152
1557
  }): this;
1153
- selectColumn(...key: (keyof T)[]): this;
1154
- updateColumn(key: keyof T, value: T[keyof T]): this;
1558
+ select(...key: (keyof T)[]): this;
1559
+ select2(sql: string, param?: Record<string, any>): this;
1560
+ update(key: keyof T, value: T[keyof T]): this;
1561
+ update2(sql: string, param?: Record<string, any>): this;
1155
1562
  updateT(t: Partial<T>): this;
1156
1563
  replace(key: keyof T, valueToFind: T[keyof T], valueToReplace: T[keyof T]): this;
1157
- }
1158
- declare class StreamQuery<T extends object> extends StreamBuild<T> {
1159
- private _service;
1160
- constructor(table: string, service: SqlService<T>);
1161
- select<L = T>(option: {
1564
+ excuteSelect<L = T>(option?: MethodOption & {
1162
1565
  sync?: SyncMode.Async;
1163
- selectResult: SelectResult.Many_Row_Many_Column | SelectResult.Many_Row_One_Column;
1566
+ selectResult?: SelectResult.RS_CS | SelectResult.RS_C;
1567
+ hump?: boolean;
1568
+ mapper?: string | SqlMapper;
1569
+ mapperIfUndefined?: MapperIfUndefined;
1164
1570
  }): Promise<L[]>;
1165
- select<L = T>(option: {
1571
+ excuteSelect<L = T>(option?: MethodOption & {
1166
1572
  sync?: SyncMode.Async;
1167
- selectResult: SelectResult.One_Row_Many_Column_Assert | SelectResult.One_Row_One_Column_Assert;
1573
+ selectResult?: SelectResult.RS_CS_List | SelectResult.RS_C_List;
1574
+ hump?: boolean;
1575
+ mapper?: string | SqlMapper;
1576
+ mapperIfUndefined?: MapperIfUndefined;
1577
+ }): Promise<ArrayList<L>>;
1578
+ excuteSelect<L = T>(option: MethodOption & {
1579
+ sync?: SyncMode.Async;
1580
+ selectResult: SelectResult.R_CS_Assert | SelectResult.R_C_Assert;
1168
1581
  errorMsg?: string;
1582
+ hump?: boolean;
1583
+ mapper?: string | SqlMapper;
1584
+ mapperIfUndefined?: MapperIfUndefined;
1169
1585
  }): Promise<L>;
1170
- select<L = T>(option: {
1586
+ excuteSelect<L = T>(option: MethodOption & {
1171
1587
  sync?: SyncMode.Async;
1172
- selectResult: SelectResult.One_Row_Many_Column_NotSure | SelectResult.One_Row_One_Column_NotSure;
1588
+ selectResult: SelectResult.R_CS_NotSure | SelectResult.R_C_NotSure;
1589
+ hump?: boolean;
1590
+ mapper?: string | SqlMapper;
1591
+ mapperIfUndefined?: MapperIfUndefined;
1173
1592
  }): Promise<L | null>;
1174
- select<L = T>(option: {
1593
+ excuteSelect<L = T>(option: MethodOption & {
1175
1594
  sync: SyncMode.Sync;
1176
- selectResult: SelectResult.Many_Row_Many_Column | SelectResult.Many_Row_One_Column;
1595
+ selectResult: SelectResult.RS_CS | SelectResult.RS_C;
1596
+ hump?: boolean;
1597
+ mapper?: string | SqlMapper;
1598
+ mapperIfUndefined?: MapperIfUndefined;
1177
1599
  }): L[];
1178
- select<L = T>(option: {
1600
+ excuteSelect<L = T>(option: MethodOption & {
1601
+ sync: SyncMode.Sync;
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 & {
1179
1608
  sync: SyncMode.Sync;
1180
- selectResult: SelectResult.One_Row_Many_Column_Assert | SelectResult.One_Row_One_Column_Assert;
1609
+ selectResult: SelectResult.R_CS_Assert | SelectResult.R_C_Assert;
1181
1610
  errorMsg?: string;
1611
+ hump?: boolean;
1612
+ mapper?: string | SqlMapper;
1613
+ mapperIfUndefined?: MapperIfUndefined;
1182
1614
  }): L;
1183
- select<L = T>(option: {
1615
+ excuteSelect<L = T>(option: MethodOption & {
1184
1616
  sync: SyncMode.Sync;
1185
- selectResult: SelectResult.One_Row_Many_Column_NotSure | SelectResult.One_Row_One_Column_NotSure;
1617
+ selectResult: SelectResult.R_CS_NotSure | SelectResult.R_C_NotSure;
1618
+ hump?: boolean;
1619
+ mapper?: string | SqlMapper;
1620
+ mapperIfUndefined?: MapperIfUndefined;
1186
1621
  }): L | null;
1187
- update(option: {
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>>;
1628
+ excuteUpdate(option?: MethodOption & {
1188
1629
  sync?: SyncMode.Async;
1189
1630
  }): Promise<number>;
1190
- update(option: {
1631
+ excuteUpdate(option: MethodOption & {
1191
1632
  sync: SyncMode.Sync;
1192
1633
  }): number;
1193
- delete(option: {
1634
+ excuteDelete(option?: MethodOption & {
1194
1635
  sync?: SyncMode.Async;
1195
1636
  }): Promise<number>;
1196
- delete(option: {
1637
+ excuteDelete(option: MethodOption & {
1197
1638
  sync: SyncMode.Sync;
1198
1639
  }): number;
1640
+ private _where;
1641
+ private _;
1642
+ private _null;
1643
+ private _key;
1644
+ private _between;
1645
+ private _in;
1646
+ private _shift;
1647
+ private _match;
1648
+ private _pow;
1649
+ private _like;
1650
+ private _includes;
1199
1651
  }
1200
1652
  /**
1201
1653
  获取REDIS客户端,
1202
1654
  # [查看库的API](https://github.com/redis/ioredis?tab=readme-ov-file)
1203
1655
  # [REDIS API](http://doc.redisfans.com/)
1204
1656
  REDIS 的API 可以直接用,将方法名转为小写
1657
+ ```
1658
+ // 设置<Redis>来获得代码提示
1659
+ getRedisDB<Redis>('').exists(?)
1660
+ ```
1205
1661
  */
1206
- export declare function getRedisDB(db?: string): any;
1662
+ export declare function getRedisDB<T = any>(db?: string): T;
1207
1663
  /**
1208
1664
  redlock
1209
1665
  */
@@ -1223,7 +1679,7 @@ export declare function excuteWithLock<T>(config: {
1223
1679
  lockMaxActive?: number;
1224
1680
  /** 单个锁多少【毫秒】后自动释放?默认:60*1000MS */
1225
1681
  lockMaxTime?: number;
1226
- }, fn__: () => Promise<T>): Promise<any>;
1682
+ }, fn__: () => Promise<T>): Promise<T>;
1227
1683
  /** 与缓存共用时,需要在缓存之前:有缓存则返回缓存,否则加锁执行并缓存,后续队列全部返回缓存,跳过执行 */
1228
1684
  export declare function MethodLock<T = any>(config: {
1229
1685
  /** 返回缓存key,参数=方法的参数[注意:必须和主方法的参数数量、完全一致,同时会追加一个当前用户对象]+当前用户对象,可以用来清空缓存。 */
@@ -1262,5 +1718,4 @@ export declare function MethodCache<T = any>(config: {
1262
1718
  /** 随着当前用户sesion的清空而一起清空 */
1263
1719
  clearWithSession?: boolean;
1264
1720
  }): (target: T, _propertyKey: string, descriptor: PropertyDescriptor) => void;
1265
- export declare const Boot: (options: GlobalSqlOption) => Promise<void>;
1266
1721
  export {};