baja-lite 1.5.18 → 1.5.19

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baja-lite",
3
- "version": "1.5.18",
3
+ "version": "1.5.19",
4
4
  "description": "some util for self",
5
5
  "homepage": "https://github.com/void-soul/baja-lite",
6
6
  "repository": {
package/sql.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import { ExtensionCodec } from "@msgpack/msgpack";
2
2
  import { _columns, _columnsNoId, _def, _deleteState, _fields, _ids, _index, _logicIds, _stateFileName, AField, DBType, EnumMap, FieldOption } from 'baja-lite-field';
3
3
  import { XML } from './convert-xml.js';
4
- import { ArrayList } from './list.js';
5
4
  export declare const extensionCodec: ExtensionCodec<undefined>;
6
5
  declare const _daoDBName: unique symbol;
7
6
  declare const _tableName: unique symbol;
@@ -94,10 +93,8 @@ export declare enum TemplateResult {
94
93
  NotSureOne = 1,
95
94
  /** 返回多条记录 */
96
95
  Many = 2,
97
- /** 返回多条记录并封装ArrayList */
98
- ManyList = 3,
99
96
  /** 仅查询记录数量 */
100
- Count = 4
97
+ Count = 3
101
98
  }
102
99
  export declare enum SelectResult {
103
100
  /** 一行一列 确定非空 */
@@ -110,12 +107,8 @@ export declare enum SelectResult {
110
107
  R_CS_NotSure = 3,
111
108
  /** 多行一列 */
112
109
  RS_C = 4,
113
- /** 多行一列并封装ArrayList */
114
- RS_C_List = 5,
115
110
  /** 多行多列 */
116
- RS_CS = 6,
117
- /** 多行多列并封装ArrayList */
118
- RS_CS_List = 7
111
+ RS_CS = 5
119
112
  }
120
113
  export declare enum ColumnMode {
121
114
  NONE = 0,
@@ -1068,30 +1061,6 @@ export declare class SqlService<T extends object> {
1068
1061
  error?: string;
1069
1062
  columns?: (keyof L)[];
1070
1063
  }): Promise<L[]>;
1071
- template<L = T>(option: MethodOption & {
1072
- sync: SyncMode.Sync;
1073
- templateResult: TemplateResult.ManyList;
1074
- id?: string | number | Array<string | number>;
1075
- where?: Partial<L> | Array<Partial<L>>;
1076
- skipUndefined?: boolean;
1077
- skipNull?: boolean;
1078
- skipEmptyString?: boolean;
1079
- mode?: SelectMode;
1080
- error?: string;
1081
- columns?: (keyof L)[];
1082
- }): ArrayList<L>;
1083
- template<L = T>(option: MethodOption & {
1084
- sync?: SyncMode.Async;
1085
- templateResult: TemplateResult.ManyList;
1086
- id?: string | number | Array<string | number>;
1087
- where?: Partial<L> | Array<Partial<L>>;
1088
- skipUndefined?: boolean;
1089
- skipNull?: boolean;
1090
- skipEmptyString?: boolean;
1091
- mode?: SelectMode;
1092
- error?: string;
1093
- columns?: (keyof L)[];
1094
- }): Promise<ArrayList<L>>;
1095
1064
  private _select;
1096
1065
  /**
1097
1066
  # 自由查询
@@ -1102,9 +1071,7 @@ export declare class SqlService<T extends object> {
1102
1071
  3. R_CS_Assert,
1103
1072
  4. R_CS_NotSure,
1104
1073
  5. RS_C,
1105
- 6. RS_C_List
1106
1074
  7. RS_CS[默认]
1107
- 8. RS_CS_List
1108
1075
  2. `sql` 或者 `sqlid`
1109
1076
  3. `params`
1110
1077
  4. `defValue`: One_Row_One_Column 时有效
@@ -1151,21 +1118,6 @@ export declare class SqlService<T extends object> {
1151
1118
  mapperIfUndefined?: MapperIfUndefined;
1152
1119
  dataConvert?: Record<string, string>;
1153
1120
  }): Promise<L[]>;
1154
- select<L = T>(option: MethodOption & {
1155
- sync?: SyncMode.Async;
1156
- selectResult: SelectResult.RS_CS_List | SelectResult.RS_C_List;
1157
- sqlId?: string;
1158
- sql?: string;
1159
- params?: Record<string, any>;
1160
- context?: any;
1161
- isCount?: boolean;
1162
- defValue?: L | null;
1163
- errorMsg?: string;
1164
- hump?: boolean;
1165
- mapper?: string | SqlMapper;
1166
- mapperIfUndefined?: MapperIfUndefined;
1167
- dataConvert?: Record<string, string>;
1168
- }): Promise<ArrayList<L>>;
1169
1121
  select<L = T>(option: MethodOption & {
1170
1122
  sync?: SyncMode.Async;
1171
1123
  selectResult: SelectResult.R_CS_Assert | SelectResult.R_C_Assert;
@@ -1211,21 +1163,6 @@ export declare class SqlService<T extends object> {
1211
1163
  mapperIfUndefined?: MapperIfUndefined;
1212
1164
  dataConvert?: Record<string, string>;
1213
1165
  }): L[];
1214
- select<L = T>(option: MethodOption & {
1215
- sync: SyncMode.Sync;
1216
- selectResult: SelectResult.RS_CS_List | SelectResult.RS_C_List;
1217
- sqlId?: string;
1218
- sql?: string;
1219
- params?: Record<string, any>;
1220
- context?: any;
1221
- isCount?: boolean;
1222
- defValue?: L | null;
1223
- errorMsg?: string;
1224
- hump?: boolean;
1225
- mapper?: string | SqlMapper;
1226
- mapperIfUndefined?: MapperIfUndefined;
1227
- dataConvert?: Record<string, string>;
1228
- }): ArrayList<L>;
1229
1166
  select<L = T>(option: MethodOption & {
1230
1167
  sync: SyncMode.Sync;
1231
1168
  selectResult: SelectResult.R_CS_Assert | SelectResult.R_C_Assert;
@@ -1291,8 +1228,9 @@ export declare class SqlService<T extends object> {
1291
1228
  // qiniu 在开始时定义
1292
1229
  ```
1293
1230
  */
1294
- selectMuit<T extends any[] = []>(option: MethodOption & {
1231
+ selectBatch<T extends any[] = []>(option: MethodOption & {
1295
1232
  sync?: SyncMode.Async;
1233
+ selectResult?: SelectResult.RS_CS | SelectResult.RS_C;
1296
1234
  sqlId?: string;
1297
1235
  sql?: string;
1298
1236
  params?: Record<string, any>;
@@ -1304,8 +1242,37 @@ export declare class SqlService<T extends object> {
1304
1242
  }): Promise<{
1305
1243
  [K in keyof T]: T[K][];
1306
1244
  }>;
1307
- selectMuit<T extends any[] = []>(option: MethodOption & {
1245
+ selectBatch<T extends any[] = []>(option: MethodOption & {
1246
+ sync?: SyncMode.Async;
1247
+ selectResult: SelectResult.R_CS_Assert | SelectResult.R_C_Assert;
1248
+ sqlId?: string;
1249
+ sql?: string;
1250
+ params?: Record<string, any>;
1251
+ context?: any;
1252
+ hump?: boolean;
1253
+ mapper?: string | SqlMapper;
1254
+ mapperIfUndefined?: MapperIfUndefined;
1255
+ dataConvert?: Record<string, string>;
1256
+ }): Promise<{
1257
+ [K in keyof T]: T[K];
1258
+ }>;
1259
+ selectBatch<T extends any[] = []>(option: MethodOption & {
1260
+ sync?: SyncMode.Async;
1261
+ selectResult: SelectResult.R_CS_NotSure | SelectResult.R_C_NotSure;
1262
+ sqlId?: string;
1263
+ sql?: string;
1264
+ params?: Record<string, any>;
1265
+ context?: any;
1266
+ hump?: boolean;
1267
+ mapper?: string | SqlMapper;
1268
+ mapperIfUndefined?: MapperIfUndefined;
1269
+ dataConvert?: Record<string, string>;
1270
+ }): Promise<{
1271
+ [K in keyof T]: T[K] | null;
1272
+ }>;
1273
+ selectBatch<T extends any[] = []>(option: MethodOption & {
1308
1274
  sync: SyncMode.Sync;
1275
+ selectResult?: SelectResult.RS_CS | SelectResult.RS_C;
1309
1276
  sqlId?: string;
1310
1277
  sql?: string;
1311
1278
  params?: Record<string, any>;
@@ -1317,6 +1284,34 @@ export declare class SqlService<T extends object> {
1317
1284
  }): {
1318
1285
  [K in keyof T]: T[K][];
1319
1286
  };
1287
+ selectBatch<T extends any[] = []>(option: MethodOption & {
1288
+ sync: SyncMode.Sync;
1289
+ selectResult: SelectResult.R_CS_Assert | SelectResult.R_C_Assert;
1290
+ sqlId?: string;
1291
+ sql?: string;
1292
+ params?: Record<string, any>;
1293
+ context?: any;
1294
+ hump?: boolean;
1295
+ mapper?: string | SqlMapper;
1296
+ mapperIfUndefined?: MapperIfUndefined;
1297
+ dataConvert?: Record<string, string>;
1298
+ }): {
1299
+ [K in keyof T]: T[K];
1300
+ };
1301
+ selectBatch<T extends any[] = []>(option: MethodOption & {
1302
+ sync: SyncMode.Sync;
1303
+ selectResult: SelectResult.R_CS_NotSure | SelectResult.R_C_NotSure;
1304
+ sqlId?: string;
1305
+ sql?: string;
1306
+ params?: Record<string, any>;
1307
+ context?: any;
1308
+ hump?: boolean;
1309
+ mapper?: string | SqlMapper;
1310
+ mapperIfUndefined?: MapperIfUndefined;
1311
+ dataConvert?: Record<string, string>;
1312
+ }): {
1313
+ [K in keyof T]: T[K] | null;
1314
+ };
1320
1315
  /**
1321
1316
  # 自由执行sql
1322
1317
  0. `sync`: 同步(sqlite)或者异步(mysql、remote),影响返回值类型,默认`异步模式`
@@ -1605,72 +1600,72 @@ declare class StreamQuery<T extends object> {
1605
1600
  skipEmptyString?: boolean | undefined;
1606
1601
  breakExcuteIfEmpty?: boolean | undefined;
1607
1602
  }): this;
1608
- /** AND key NOT LIKE :value */
1603
+ /** AND key LIKE :value 注意:不会拼接% */
1609
1604
  PreciseLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1610
1605
  paramName?: string | undefined;
1611
1606
  skipEmptyString?: boolean | undefined;
1612
1607
  breakExcuteIfEmpty?: boolean | undefined;
1613
1608
  }): this;
1614
- /** AND key LIKE :value */
1609
+ /** AND key NOT LIKE :value 注意:不会拼接%*/
1615
1610
  notPreciseLike(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1616
1611
  paramName?: string | undefined;
1617
1612
  skipEmptyString?: boolean | undefined;
1618
1613
  breakExcuteIfEmpty?: boolean | undefined;
1619
1614
  }): this;
1620
- /** AND key GLOB CONCAT('%', :value, '%') */
1615
+ /** AND key GLOB CONCAT('%', :value, '%') 注意:GLOB是大小写敏感like */
1621
1616
  glob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1622
1617
  paramName?: string | undefined;
1623
1618
  skipEmptyString?: boolean | undefined;
1624
1619
  breakExcuteIfEmpty?: boolean | undefined;
1625
1620
  }): this;
1626
- /** AND key NOT GLOB CONCAT('%', :value, '%') */
1621
+ /** AND key NOT GLOB CONCAT('%', :value, '%') 注意:GLOB是大小写敏感like*/
1627
1622
  notGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1628
1623
  paramName?: string | undefined;
1629
1624
  skipEmptyString?: boolean | undefined;
1630
1625
  breakExcuteIfEmpty?: boolean | undefined;
1631
1626
  }): this;
1632
- /** AND key GLOB CONCAT('%', :value) */
1627
+ /** AND key GLOB CONCAT('%', :value) 注意:GLOB是大小写敏感like*/
1633
1628
  leftGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1634
1629
  paramName?: string | undefined;
1635
1630
  skipEmptyString?: boolean | undefined;
1636
1631
  breakExcuteIfEmpty?: boolean | undefined;
1637
1632
  }): this;
1638
- /** AND key NOT GLOB CONCAT('%', :value) */
1633
+ /** AND key NOT GLOB CONCAT('%', :value) 注意:GLOB是大小写敏感like*/
1639
1634
  notLeftGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1640
1635
  paramName?: string | undefined;
1641
1636
  skipEmptyString?: boolean | undefined;
1642
1637
  breakExcuteIfEmpty?: boolean | undefined;
1643
1638
  }): this;
1644
- /** AND key GLOB CONCAT(:value, '%') */
1639
+ /** AND key GLOB CONCAT(:value, '%') 注意:GLOB是大小写敏感like*/
1645
1640
  rightGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1646
1641
  paramName?: string | undefined;
1647
1642
  skipEmptyString?: boolean | undefined;
1648
1643
  breakExcuteIfEmpty?: boolean | undefined;
1649
1644
  }): this;
1650
- /** AND key NOT GLOB CONCAT(:value, '%') */
1645
+ /** AND key NOT GLOB CONCAT(:value, '%') 注意:GLOB是大小写敏感like*/
1651
1646
  notRightGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1652
1647
  paramName?: string | undefined;
1653
1648
  skipEmptyString?: boolean | undefined;
1654
1649
  breakExcuteIfEmpty?: boolean | undefined;
1655
1650
  }): this;
1656
- /** AND key GLOB :value */
1651
+ /** AND key GLOB :value 注意:GLOB是大小写敏感like,这里不拼接%*/
1657
1652
  PreciseGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1658
1653
  paramName?: string | undefined;
1659
1654
  skipEmptyString?: boolean | undefined;
1660
1655
  breakExcuteIfEmpty?: boolean | undefined;
1661
1656
  }): this;
1662
- /** AND key NOT GLOB :value */
1657
+ /** AND key NOT GLOB :value 注意:GLOB是大小写敏感like,这里不拼接%*/
1663
1658
  notPreciseGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1664
1659
  paramName?: string | undefined;
1665
1660
  skipEmptyString?: boolean | undefined;
1666
1661
  breakExcuteIfEmpty?: boolean | undefined;
1667
1662
  }): this;
1668
- /** AND key IN :value */
1663
+ /** AND key IN (:value) */
1669
1664
  in(key: keyof T, value: Array<string | number>, { paramName, breakExcuteIfEmpty }?: {
1670
1665
  paramName?: string | undefined;
1671
1666
  breakExcuteIfEmpty?: boolean | undefined;
1672
1667
  }): this;
1673
- /** AND key NOT IN :value */
1668
+ /** AND key NOT IN (:value) */
1674
1669
  notIn(key: keyof T, value: Array<string | number>, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1675
1670
  paramName?: string | undefined;
1676
1671
  skipEmptyString?: boolean | undefined;
@@ -1838,14 +1833,6 @@ declare class StreamQuery<T extends object> {
1838
1833
  mapperIfUndefined?: MapperIfUndefined;
1839
1834
  dataConvert?: Record<string, string>;
1840
1835
  }): Promise<L[]>;
1841
- excuteSelect<L = T>(option?: MethodOption & {
1842
- sync?: SyncMode.Async;
1843
- selectResult?: SelectResult.RS_CS_List | SelectResult.RS_C_List;
1844
- hump?: boolean;
1845
- mapper?: string | SqlMapper;
1846
- mapperIfUndefined?: MapperIfUndefined;
1847
- dataConvert?: Record<string, string>;
1848
- }): Promise<ArrayList<L>>;
1849
1836
  excuteSelect<L = T>(option: MethodOption & {
1850
1837
  sync?: SyncMode.Async;
1851
1838
  selectResult: SelectResult.R_CS_Assert | SelectResult.R_C_Assert;
@@ -1871,14 +1858,6 @@ declare class StreamQuery<T extends object> {
1871
1858
  mapperIfUndefined?: MapperIfUndefined;
1872
1859
  dataConvert?: Record<string, string>;
1873
1860
  }): L[];
1874
- excuteSelect<L = T>(option: MethodOption & {
1875
- sync: SyncMode.Sync;
1876
- selectResult: SelectResult.RS_CS_List | SelectResult.RS_C_List;
1877
- hump?: boolean;
1878
- mapper?: string | SqlMapper;
1879
- mapperIfUndefined?: MapperIfUndefined;
1880
- dataConvert?: Record<string, string>;
1881
- }): ArrayList<L>;
1882
1861
  excuteSelect<L = T>(option: MethodOption & {
1883
1862
  sync: SyncMode.Sync;
1884
1863
  selectResult: SelectResult.R_CS_Assert | SelectResult.R_C_Assert;
package/sql.js CHANGED
@@ -21,7 +21,6 @@ import tslib from 'tslib';
21
21
  import { convert } from './convert-xml.js';
22
22
  import { Throw } from './error.js';
23
23
  import { excuteSplit, ExcuteSplitMode, sleep } from './fn.js';
24
- import { ArrayList } from './list.js';
25
24
  import { add, calc, ten2Any } from './math.js';
26
25
  import { C2P, C2P2, P2C } from './object.js';
27
26
  import { emptyString } from './string.js';
@@ -179,10 +178,8 @@ export var TemplateResult;
179
178
  TemplateResult[TemplateResult["NotSureOne"] = 1] = "NotSureOne";
180
179
  /** 返回多条记录 */
181
180
  TemplateResult[TemplateResult["Many"] = 2] = "Many";
182
- /** 返回多条记录并封装ArrayList */
183
- TemplateResult[TemplateResult["ManyList"] = 3] = "ManyList";
184
181
  /** 仅查询记录数量 */
185
- TemplateResult[TemplateResult["Count"] = 4] = "Count";
182
+ TemplateResult[TemplateResult["Count"] = 3] = "Count";
186
183
  })(TemplateResult || (TemplateResult = {}));
187
184
  export var SelectResult;
188
185
  (function (SelectResult) {
@@ -196,12 +193,8 @@ export var SelectResult;
196
193
  SelectResult[SelectResult["R_CS_NotSure"] = 3] = "R_CS_NotSure";
197
194
  /** 多行一列 */
198
195
  SelectResult[SelectResult["RS_C"] = 4] = "RS_C";
199
- /** 多行一列并封装ArrayList */
200
- SelectResult[SelectResult["RS_C_List"] = 5] = "RS_C_List";
201
196
  /** 多行多列 */
202
- SelectResult[SelectResult["RS_CS"] = 6] = "RS_CS";
203
- /** 多行多列并封装ArrayList */
204
- SelectResult[SelectResult["RS_CS_List"] = 7] = "RS_CS_List";
197
+ SelectResult[SelectResult["RS_CS"] = 5] = "RS_CS";
205
198
  })(SelectResult || (SelectResult = {}));
206
199
  export var ColumnMode;
207
200
  (function (ColumnMode) {
@@ -2649,9 +2642,6 @@ export class SqlService {
2649
2642
  case TemplateResult.Count: {
2650
2643
  return result[0].ct;
2651
2644
  }
2652
- case TemplateResult.ManyList: {
2653
- return new ArrayList(result[0]);
2654
- }
2655
2645
  }
2656
2646
  }
2657
2647
  template(option) {
@@ -2823,39 +2813,6 @@ export class SqlService {
2823
2813
  }
2824
2814
  }
2825
2815
  }
2826
- case SelectResult.RS_C_List: {
2827
- try {
2828
- if (dataConvert) {
2829
- const key = Object.keys(result[0])[0];
2830
- if (key && dataConvert[key] && globalThis[_DataConvert][dataConvert[key]]) {
2831
- return new ArrayList(result.map((r) => globalThis[_DataConvert][dataConvert[key]](Object.values(r)[0])));
2832
- }
2833
- }
2834
- return new ArrayList(result.map((r) => Object.values(r)[0]));
2835
- }
2836
- catch (error) {
2837
- return new ArrayList();
2838
- }
2839
- }
2840
- case SelectResult.RS_CS_List: {
2841
- if (mapper) {
2842
- return new ArrayList(iterate(result).map((data) => flatData({
2843
- data,
2844
- mapper,
2845
- mapperIfUndefined
2846
- })).toArray());
2847
- }
2848
- else {
2849
- hump = hump === true || (hump === undefined && globalThis[_Hump] === true);
2850
- const __dataConvert = dataConvert ? Object.fromEntries(Object.entries(dataConvert).map(([k, v]) => [k, globalThis[_DataConvert][v]])) : undefined;
2851
- if (hump || __dataConvert) {
2852
- return new ArrayList(iterate(result).map((r) => C2P2(r, hump, __dataConvert)).toArray());
2853
- }
2854
- else {
2855
- return new ArrayList();
2856
- }
2857
- }
2858
- }
2859
2816
  }
2860
2817
  }
2861
2818
  select(option) {
@@ -2884,8 +2841,9 @@ export class SqlService {
2884
2841
  });
2885
2842
  }
2886
2843
  }
2887
- selectMuit(option) {
2844
+ selectBatch(option) {
2888
2845
  Throw.if(!option.sqlId && !option.sql, 'not found sql!');
2846
+ option.selectResult ?? (option.selectResult = SelectResult.RS_CS);
2889
2847
  if (option.sqlId && globalThis[_resultMap_SQLID][option.sqlId] && !option.mapper) {
2890
2848
  option.mapper = globalThis[_resultMap_SQLID][option.sqlId];
2891
2849
  }
@@ -2894,13 +2852,13 @@ export class SqlService {
2894
2852
  const { sql, params } = this._generSql(option.dbType, option.sql, _params);
2895
2853
  if (option.sync === SyncMode.Sync) {
2896
2854
  const result = option.conn.query(SyncMode.Sync, sql, params);
2897
- return result.map(item => this._select(SelectResult.RS_CS, result, null, undefined, option.hump, option.mapper, option.mapperIfUndefined, option.dataConvert));
2855
+ return result.map(item => this._select(option.selectResult, result, null, undefined, option.hump, option.mapper, option.mapperIfUndefined, option.dataConvert));
2898
2856
  }
2899
2857
  else {
2900
2858
  return new Promise(async (resolve, reject) => {
2901
2859
  try {
2902
2860
  const result = await option.conn.query(SyncMode.Async, sql, params);
2903
- resolve(result.map(item => this._select(SelectResult.RS_CS, result, null, undefined, option.hump, option.mapper, option.mapperIfUndefined, option.dataConvert)));
2861
+ resolve(result.map(item => this._select(option.selectResult, result, null, undefined, option.hump, option.mapper, option.mapperIfUndefined, option.dataConvert)));
2904
2862
  }
2905
2863
  catch (error) {
2906
2864
  reject(error);
@@ -3405,7 +3363,7 @@ __decorate([
3405
3363
  __metadata("design:type", Function),
3406
3364
  __metadata("design:paramtypes", [Object]),
3407
3365
  __metadata("design:returntype", Object)
3408
- ], SqlService.prototype, "selectMuit", null);
3366
+ ], SqlService.prototype, "selectBatch", null);
3409
3367
  __decorate([
3410
3368
  P(),
3411
3369
  __metadata("design:type", Function),
@@ -3599,29 +3557,29 @@ class StreamQuery {
3599
3557
  rightLike(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, right: '%', breakExcuteIfEmpty }); }
3600
3558
  /** AND key NOT LIKE CONCAT(:value, '%') */
3601
3559
  notRightLike(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, right: '%', not: 'NOT', breakExcuteIfEmpty }); }
3602
- /** AND key NOT LIKE :value */
3560
+ /** AND key LIKE :value 注意:不会拼接% */
3603
3561
  PreciseLike(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, breakExcuteIfEmpty }); }
3604
- /** AND key LIKE :value */
3562
+ /** AND key NOT LIKE :value 注意:不会拼接%*/
3605
3563
  notPreciseLike(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfEmpty }); }
3606
- /** AND key GLOB CONCAT('%', :value, '%') */
3564
+ /** AND key GLOB CONCAT('%', :value, '%') 注意:GLOB是大小写敏感like */
3607
3565
  glob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, left: '%', right: '%', breakExcuteIfEmpty, op: 'GLOB' }); }
3608
- /** AND key NOT GLOB CONCAT('%', :value, '%') */
3566
+ /** AND key NOT GLOB CONCAT('%', :value, '%') 注意:GLOB是大小写敏感like*/
3609
3567
  notGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, left: '%', right: '%', not: 'NOT', breakExcuteIfEmpty, op: 'GLOB' }); }
3610
- /** AND key GLOB CONCAT('%', :value) */
3568
+ /** AND key GLOB CONCAT('%', :value) 注意:GLOB是大小写敏感like*/
3611
3569
  leftGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, left: '%', breakExcuteIfEmpty, op: 'GLOB' }); }
3612
- /** AND key NOT GLOB CONCAT('%', :value) */
3570
+ /** AND key NOT GLOB CONCAT('%', :value) 注意:GLOB是大小写敏感like*/
3613
3571
  notLeftGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, left: '%', not: 'NOT', breakExcuteIfEmpty, op: 'GLOB' }); }
3614
- /** AND key GLOB CONCAT(:value, '%') */
3572
+ /** AND key GLOB CONCAT(:value, '%') 注意:GLOB是大小写敏感like*/
3615
3573
  rightGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, right: '%', breakExcuteIfEmpty, op: 'GLOB' }); }
3616
- /** AND key NOT GLOB CONCAT(:value, '%') */
3574
+ /** AND key NOT GLOB CONCAT(:value, '%') 注意:GLOB是大小写敏感like*/
3617
3575
  notRightGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, right: '%', not: 'NOT', breakExcuteIfEmpty, op: 'GLOB' }); }
3618
- /** AND key GLOB :value */
3576
+ /** AND key GLOB :value 注意:GLOB是大小写敏感like,这里不拼接%*/
3619
3577
  PreciseGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, breakExcuteIfEmpty, op: 'GLOB' }); }
3620
- /** AND key NOT GLOB :value */
3578
+ /** AND key NOT GLOB :value 注意:GLOB是大小写敏感like,这里不拼接%*/
3621
3579
  notPreciseGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfEmpty, op: 'GLOB' }); }
3622
- /** AND key IN :value */
3580
+ /** AND key IN (:value) */
3623
3581
  in(key, value, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._in(key, value, { paramName, breakExcuteIfEmpty }); }
3624
- /** AND key NOT IN :value */
3582
+ /** AND key NOT IN (:value) */
3625
3583
  notIn(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._in(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfEmpty }); }
3626
3584
  /** AND :value IN (key1, key2, ...) */
3627
3585
  in2(key, value, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._in2(key, value, { paramName, breakExcuteIfEmpty }); }
@@ -3827,8 +3785,6 @@ class StreamQuery {
3827
3785
  switch (option.selectResult) {
3828
3786
  case SelectResult.RS_CS: return this._service.select({ ...option, sync: SyncMode.Async, selectResult: SelectResult.RS_CS, sql, params });
3829
3787
  case SelectResult.RS_C: return this._service.select({ ...option, sync: SyncMode.Async, selectResult: SelectResult.RS_C, sql, params });
3830
- case SelectResult.RS_CS_List: return this._service.select({ ...option, sync: SyncMode.Async, selectResult: SelectResult.RS_CS_List, sql, params });
3831
- case SelectResult.RS_C_List: return this._service.select({ ...option, sync: SyncMode.Async, selectResult: SelectResult.RS_C_List, sql, params });
3832
3788
  case SelectResult.R_CS_Assert: return this._service.select({ ...option, sync: SyncMode.Async, selectResult: SelectResult.R_CS_Assert, sql, params });
3833
3789
  case SelectResult.R_C_Assert: return this._service.select({ ...option, sync: SyncMode.Async, selectResult: SelectResult.R_C_Assert, sql, params });
3834
3790
  case SelectResult.R_CS_NotSure: return this._service.select({ ...option, sync: SyncMode.Async, selectResult: SelectResult.R_CS_NotSure, sql, params });
@@ -3839,8 +3795,6 @@ class StreamQuery {
3839
3795
  switch (option.selectResult) {
3840
3796
  case SelectResult.RS_CS: return this._service.select({ ...option, sync: SyncMode.Sync, selectResult: SelectResult.RS_CS, sql, params });
3841
3797
  case SelectResult.RS_C: return this._service.select({ ...option, sync: SyncMode.Sync, selectResult: SelectResult.RS_C, sql, params });
3842
- case SelectResult.RS_CS_List: return this._service.select({ ...option, sync: SyncMode.Sync, selectResult: SelectResult.RS_CS_List, sql, params });
3843
- case SelectResult.RS_C_List: return this._service.select({ ...option, sync: SyncMode.Sync, selectResult: SelectResult.RS_C_List, sql, params });
3844
3798
  case SelectResult.R_CS_Assert: return this._service.select({ ...option, sync: SyncMode.Sync, selectResult: SelectResult.R_CS_Assert, sql, params });
3845
3799
  case SelectResult.R_C_Assert: return this._service.select({ ...option, sync: SyncMode.Sync, selectResult: SelectResult.R_C_Assert, sql, params });
3846
3800
  case SelectResult.R_CS_NotSure: return this._service.select({ ...option, sync: SyncMode.Sync, selectResult: SelectResult.R_CS_NotSure, sql, params });
package/test-mysql.js CHANGED
@@ -78,6 +78,12 @@ let BaseAuditUserService = class BaseAuditUserService extends SqlService {
78
78
  BaseAuditUserService = __decorate([
79
79
  DB({ tableName: 'base_audit_user', clz: BaseAuditUser })
80
80
  ], BaseAuditUserService);
81
+ function select() {
82
+ return [];
83
+ }
84
+ function select2() {
85
+ return [];
86
+ }
81
87
  export async function go2() {
82
88
  await Boot({
83
89
  Mysql: {
@@ -100,9 +106,10 @@ export async function go2() {
100
106
  }
101
107
  });
102
108
  const service = new BaseAuditUserService();
103
- const data = await service.selectMuit({ sqlId: 'test.test', params: { realname: '张薇' } });
109
+ const data = await service.selectBatch({ sqlId: 'test.test', params: { realname: '张薇' } });
104
110
  console.log(11, data[0][0]?.userProvinceCode);
105
111
  console.log(11, data[1].length);
112
+ const dd = select2();
106
113
  // const list = await service.transaction<number>({
107
114
  // fn: async conn => {
108
115
  // await service.stream().eq('baseType', '0').in('auditId', ['162400829591265280', '162201628882247680']).excuteSelect();
package/list.d.ts DELETED
@@ -1,10 +0,0 @@
1
- export declare class ArrayList<T> extends Array<T> {
2
- constructor(array?: Array<T> | T | undefined);
3
- add(...items: T[]): void;
4
- size(): number;
5
- isEmpty(): boolean;
6
- get(index: number): T | undefined;
7
- clear(): void;
8
- set(index: number, item: T): void;
9
- remove(index: number): void;
10
- }
package/list.js DELETED
@@ -1,56 +0,0 @@
1
- export class ArrayList extends Array {
2
- constructor(array) {
3
- super();
4
- if (array instanceof Array) {
5
- super.push(...array);
6
- }
7
- else if (typeof array !== 'undefined') {
8
- super.push(array);
9
- }
10
- }
11
- add(...items) {
12
- this.push(...items);
13
- }
14
- size() {
15
- return this.length;
16
- }
17
- isEmpty() {
18
- return this.length === 0;
19
- }
20
- get(index) {
21
- return this[index];
22
- }
23
- clear() {
24
- this.length = 0;
25
- }
26
- set(index, item) {
27
- this[index] = item;
28
- }
29
- remove(index) {
30
- this.splice(index, 1);
31
- }
32
- }
33
- // export class ArrayMap<T> extends Array<T> {
34
- // private _map: Map<string, T> = new Map();
35
- // private key: keyof T;
36
- // constructor(key: keyof T, array?: Array<T> | T | undefined) {
37
- // super();
38
- // this.key = key;
39
- // if (array instanceof Array) {
40
- // super.push(...array);
41
- // } else if (typeof array !== 'undefined') {
42
- // super.push(array);
43
- // }
44
- // }
45
- // override push(...items: T[]): number {
46
- // for (const item of items) {
47
- // const key = item[this.key] as string;
48
- // if (!this._map.has(key)) {
49
- // super.push(item);
50
- // this._map.set(key, item);
51
- // }
52
- // }
53
- // return this.length;
54
- // }
55
- // override
56
- // }