baja-lite 1.5.19 → 1.5.20

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/code.js CHANGED
@@ -86,7 +86,8 @@ console.log(`
86
86
  "logicDeleteK"?: "逻辑删除字段名",
87
87
  "logicDeleteV"?: "逻辑删除值",如果是字符串需要这样 logicDeleteV: "'0'"
88
88
  "NotlogicDeleteV"?: "未逻辑删除值",如果是字符串需要这样 NotlogicDeleteV: "'0'",
89
- "skipColumns"?: ["跳过的列名1", "跳过的列名2"]
89
+ "skipColumns"?: ["跳过的列名1", "跳过的列名2"],
90
+ "custom"?: (列名:string) => string; 该属性支持为每个数据库列自定义一个名称,例如 字段名为 ci_name 可通过custom改造为 Ci Name
90
91
  }
91
92
  command是生成命令,这里声明命令同时定义文件生成路径:可用下面的变量替换.同时必须有同名模板.
92
93
  路径是相对于项目根目录的
@@ -98,7 +99,7 @@ console.log(`
98
99
  **********************-----------
99
100
  模板文件
100
101
  请在项目根目录的code-template添加模板文件, 按照mustache(标签定义成了[ '<%', '%>' ])进行格式化,支持使用的变量:
101
- ************* 以下假设表名为event_main_info,列名为sku_id,sku_name
102
+ ************* 以下假设表名为event_main_info,列名为sku_id,sku_name
102
103
  title // 字符串,表的注释
103
104
 
104
105
  tableName // 字符串,event_main_info
@@ -109,7 +110,7 @@ console.log(`
109
110
  splitName // 字符串,event/main/info
110
111
  SplitName // 字符串,event/mainInfo
111
112
 
112
- columns // 数组, 元素格式为{comment:注释,name: sku_id,Name: skuId,NAME: SkuId,Field:表示字段的注解,JSField_name, JSFieldName 分别表示JS的注解,Type:表示JS类型}
113
+ columns // 数组, 元素格式为{comment:注释,name: sku_id,Name: skuId,NAME: SkuId,Field:表示字段的注解,JSField_nameJSFieldName 分别表示JS的注解,Type:表示JS类型,custom:自定义列名}
113
114
  column_names // 数组, 元素是列名字符串,格式是 sku_id,sku_name
114
115
  ColumnNames // 数组, 元素是列名字符串,格式是 skuId,skuName
115
116
  column_names_join // 字符串,列名join的字符串,格式是 "sku_id,sku_name"
@@ -141,12 +142,12 @@ console.log(`
141
142
  modelPath // 模块名称实际就影响访问路径,所以这里会直接拼好controller的模块访问路径,如果模块为空,则该属性就是空字符串,否则是 /模块名称/
142
143
 
143
144
  logicDelete // 逻辑删除的查询条件,可以附加在sql条件的末尾,可能是空的
144
- -----
145
- 命令 table1,table2,table3:模块名称
145
+ ---------------------------------------------------------------------------------------------------------------
146
+ .命令 table1,table2,table3:模块名称
146
147
  table=. 表示扫描全库表
147
148
  :模块名称 可以省略
148
149
  -----
149
- force: 切换是否覆盖
150
+ .force: 切换是否覆盖
150
151
  `);
151
152
  try {
152
153
  const outputs = new Set();
@@ -272,6 +273,9 @@ try {
272
273
  r.Field = `@Field({${fields.join(',')}})`;
273
274
  r.JSField_name = `{${fields.join(',')}, P: '${r.name}'}`;
274
275
  r.JSFieldName = `{${fields.join(',')}, P: '${r.Name}'}`;
276
+ if (configData.custom) {
277
+ r.custom = configData.custom(r.name);
278
+ }
275
279
  return r;
276
280
  });
277
281
  conn.release();
package/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
1
  import 'reflect-metadata';
2
2
  export * from './error.js';
3
3
  export * from './fn.js';
4
- export * from './list.js';
5
4
  export * from './math.js';
6
5
  export * from './object.js';
7
6
  export * from './snowflake.js';
package/index.js CHANGED
@@ -1,7 +1,6 @@
1
1
  import 'reflect-metadata';
2
2
  export * from './error.js';
3
3
  export * from './fn.js';
4
- export * from './list.js';
5
4
  export * from './math.js';
6
5
  export * from './object.js';
7
6
  export * from './snowflake.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baja-lite",
3
- "version": "1.5.19",
3
+ "version": "1.5.20",
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
@@ -1516,26 +1516,6 @@ declare class StreamQuery<T extends object> {
1516
1516
  eqWith(key1: keyof T, key2: keyof T): this;
1517
1517
  /** AND key1 <> key2 */
1518
1518
  notEqWith(key1: keyof T, key2: keyof T): this;
1519
- /** AND key REGEXP :regexp */
1520
- regexp(key: keyof T, regexp: string, { paramName, breakExcuteIfEmpty }?: {
1521
- paramName?: string | undefined;
1522
- breakExcuteIfEmpty?: boolean | undefined;
1523
- }): this;
1524
- /** AND key NOT REGEXP :regexp */
1525
- notRegexp(key: keyof T, regexp: string, { paramName, breakExcuteIfEmpty }?: {
1526
- paramName?: string | undefined;
1527
- breakExcuteIfEmpty?: boolean | undefined;
1528
- }): this;
1529
- /** AND (key1 << 8) + key2 = value */
1530
- shiftEq(key1: keyof T, key2: keyof T, value: number, { paramName, breakExcuteIfEmpty }?: {
1531
- paramName?: string | undefined;
1532
- breakExcuteIfEmpty?: boolean | undefined;
1533
- }): this;
1534
- /** AND (key1 << 8) + key2 <> value */
1535
- shiftNotEq(key1: keyof T, key2: keyof T, value: number, { paramName, breakExcuteIfEmpty }?: {
1536
- paramName?: string | undefined;
1537
- breakExcuteIfEmpty?: boolean | undefined;
1538
- }): this;
1539
1519
  /** AND key > :value */
1540
1520
  grate(key: keyof T, value: string | number, { paramName, breakExcuteIfEmpty }?: {
1541
1521
  paramName?: string | undefined;
@@ -1564,6 +1544,36 @@ declare class StreamQuery<T extends object> {
1564
1544
  lessWith(key1: keyof T, key2: keyof T): this;
1565
1545
  /** AND key1 <= key2 */
1566
1546
  lessEqWith(key1: keyof T, key2: keyof T): this;
1547
+ /** AND key REGEXP :regexp */
1548
+ regexp(key: keyof T, regexp: string, { paramName, breakExcuteIfEmpty }?: {
1549
+ paramName?: string | undefined;
1550
+ breakExcuteIfEmpty?: boolean | undefined;
1551
+ }): this;
1552
+ /** AND key NOT REGEXP :regexp */
1553
+ notRegexp(key: keyof T, regexp: string, { paramName, breakExcuteIfEmpty }?: {
1554
+ paramName?: string | undefined;
1555
+ breakExcuteIfEmpty?: boolean | undefined;
1556
+ }): this;
1557
+ /** AND :regexp REGEXP key */
1558
+ regexp2(key: keyof T, regexp: string, { paramName, breakExcuteIfEmpty }?: {
1559
+ paramName?: string | undefined;
1560
+ breakExcuteIfEmpty?: boolean | undefined;
1561
+ }): this;
1562
+ /** AND :regexp NOT REGEXP key */
1563
+ notRegexp2(key: keyof T, regexp: string, { paramName, breakExcuteIfEmpty }?: {
1564
+ paramName?: string | undefined;
1565
+ breakExcuteIfEmpty?: boolean | undefined;
1566
+ }): this;
1567
+ /** AND (key1 << 8) + key2 = value */
1568
+ shiftEq(key1: keyof T, key2: keyof T, value: number, { paramName, breakExcuteIfEmpty }?: {
1569
+ paramName?: string | undefined;
1570
+ breakExcuteIfEmpty?: boolean | undefined;
1571
+ }): this;
1572
+ /** AND (key1 << 8) + key2 <> value */
1573
+ shiftNotEq(key1: keyof T, key2: keyof T, value: number, { paramName, breakExcuteIfEmpty }?: {
1574
+ paramName?: string | undefined;
1575
+ breakExcuteIfEmpty?: boolean | undefined;
1576
+ }): this;
1567
1577
  /** AND key LIKE CONCAT('%', :value, '%') */
1568
1578
  like(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1569
1579
  paramName?: string | undefined;
@@ -1649,7 +1659,7 @@ declare class StreamQuery<T extends object> {
1649
1659
  breakExcuteIfEmpty?: boolean | undefined;
1650
1660
  }): this;
1651
1661
  /** AND key GLOB :value 注意:GLOB是大小写敏感like,这里不拼接%*/
1652
- PreciseGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1662
+ preciseGlob(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1653
1663
  paramName?: string | undefined;
1654
1664
  skipEmptyString?: boolean | undefined;
1655
1665
  breakExcuteIfEmpty?: boolean | undefined;
@@ -1660,6 +1670,102 @@ declare class StreamQuery<T extends object> {
1660
1670
  skipEmptyString?: boolean | undefined;
1661
1671
  breakExcuteIfEmpty?: boolean | undefined;
1662
1672
  }): this;
1673
+ /** AND :value LIKE CONCAT('%', key, '%') */
1674
+ like2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1675
+ paramName?: string | undefined;
1676
+ skipEmptyString?: boolean | undefined;
1677
+ breakExcuteIfEmpty?: boolean | undefined;
1678
+ }): this;
1679
+ /** AND :value NOT LIKE CONCAT('%', key, '%') */
1680
+ notLike2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1681
+ paramName?: string | undefined;
1682
+ skipEmptyString?: boolean | undefined;
1683
+ breakExcuteIfEmpty?: boolean | undefined;
1684
+ }): this;
1685
+ /** AND :value NOT LIKE CONCAT('%', key) */
1686
+ leftLike2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1687
+ paramName?: string | undefined;
1688
+ skipEmptyString?: boolean | undefined;
1689
+ breakExcuteIfEmpty?: boolean | undefined;
1690
+ }): this;
1691
+ /** AND :value LIKE CONCAT('%', key) */
1692
+ notLeftLike2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1693
+ paramName?: string | undefined;
1694
+ skipEmptyString?: boolean | undefined;
1695
+ breakExcuteIfEmpty?: boolean | undefined;
1696
+ }): this;
1697
+ /** AND :value LIKE CONCAT(key, '%') */
1698
+ rightLike2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1699
+ paramName?: string | undefined;
1700
+ skipEmptyString?: boolean | undefined;
1701
+ breakExcuteIfEmpty?: boolean | undefined;
1702
+ }): this;
1703
+ /** AND :value NOT LIKE CONCAT(key, '%') */
1704
+ notRightLike2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1705
+ paramName?: string | undefined;
1706
+ skipEmptyString?: boolean | undefined;
1707
+ breakExcuteIfEmpty?: boolean | undefined;
1708
+ }): this;
1709
+ /** AND :value LIKE key 注意:不会拼接% */
1710
+ PreciseLike2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1711
+ paramName?: string | undefined;
1712
+ skipEmptyString?: boolean | undefined;
1713
+ breakExcuteIfEmpty?: boolean | undefined;
1714
+ }): this;
1715
+ /** AND :value NOT LIKE key 注意:不会拼接%*/
1716
+ notPreciseLike2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1717
+ paramName?: string | undefined;
1718
+ skipEmptyString?: boolean | undefined;
1719
+ breakExcuteIfEmpty?: boolean | undefined;
1720
+ }): this;
1721
+ /** AND :value GLOB CONCAT('%', key, '%') 注意:GLOB是大小写敏感like */
1722
+ glob2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1723
+ paramName?: string | undefined;
1724
+ skipEmptyString?: boolean | undefined;
1725
+ breakExcuteIfEmpty?: boolean | undefined;
1726
+ }): this;
1727
+ /** AND :value NOT GLOB CONCAT('%', key, '%') 注意:GLOB是大小写敏感like*/
1728
+ notGlob2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1729
+ paramName?: string | undefined;
1730
+ skipEmptyString?: boolean | undefined;
1731
+ breakExcuteIfEmpty?: boolean | undefined;
1732
+ }): this;
1733
+ /** AND :value GLOB CONCAT('%', key) 注意:GLOB是大小写敏感like*/
1734
+ leftGlob2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1735
+ paramName?: string | undefined;
1736
+ skipEmptyString?: boolean | undefined;
1737
+ breakExcuteIfEmpty?: boolean | undefined;
1738
+ }): this;
1739
+ /** AND :value NOT GLOB CONCAT('%', key) 注意:GLOB是大小写敏感like*/
1740
+ notLeftGlob2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1741
+ paramName?: string | undefined;
1742
+ skipEmptyString?: boolean | undefined;
1743
+ breakExcuteIfEmpty?: boolean | undefined;
1744
+ }): this;
1745
+ /** AND :value GLOB CONCAT(key, '%') 注意:GLOB是大小写敏感like*/
1746
+ rightGlob2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1747
+ paramName?: string | undefined;
1748
+ skipEmptyString?: boolean | undefined;
1749
+ breakExcuteIfEmpty?: boolean | undefined;
1750
+ }): this;
1751
+ /** AND :value NOT GLOB CONCAT(key, '%') 注意:GLOB是大小写敏感like*/
1752
+ notRightGlob2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1753
+ paramName?: string | undefined;
1754
+ skipEmptyString?: boolean | undefined;
1755
+ breakExcuteIfEmpty?: boolean | undefined;
1756
+ }): this;
1757
+ /** AND :value GLOB key 注意:GLOB是大小写敏感like,这里不拼接%*/
1758
+ preciseGlob2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1759
+ paramName?: string | undefined;
1760
+ skipEmptyString?: boolean | undefined;
1761
+ breakExcuteIfEmpty?: boolean | undefined;
1762
+ }): this;
1763
+ /** AND :value NOT GLOB key 注意:GLOB是大小写敏感like,这里不拼接%*/
1764
+ notPreciseGlob2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1765
+ paramName?: string | undefined;
1766
+ skipEmptyString?: boolean | undefined;
1767
+ breakExcuteIfEmpty?: boolean | undefined;
1768
+ }): this;
1663
1769
  /** AND key IN (:value) */
1664
1770
  in(key: keyof T, value: Array<string | number>, { paramName, breakExcuteIfEmpty }?: {
1665
1771
  paramName?: string | undefined;
@@ -1712,6 +1818,16 @@ declare class StreamQuery<T extends object> {
1712
1818
  paramName?: string | undefined;
1713
1819
  breakExcuteIfEmpty?: boolean | undefined;
1714
1820
  }): this;
1821
+ /** AND POW(2, :value) & key */
1822
+ pow2(key: keyof T, value: number, { paramName, breakExcuteIfEmpty }?: {
1823
+ paramName?: string | undefined;
1824
+ breakExcuteIfEmpty?: boolean | undefined;
1825
+ }): this;
1826
+ /** AND NOT POW(2, :value) & key */
1827
+ notPow2(key: keyof T, value: number, { paramName, breakExcuteIfEmpty }?: {
1828
+ paramName?: string | undefined;
1829
+ breakExcuteIfEmpty?: boolean | undefined;
1830
+ }): this;
1715
1831
  /** AND POW(2, key1) & key2 */
1716
1832
  powWith(key: keyof T, values: Array<number | string>, { paramName, breakExcuteIfEmpty }?: {
1717
1833
  paramName?: string | undefined;
@@ -1722,43 +1838,43 @@ declare class StreamQuery<T extends object> {
1722
1838
  paramName?: string | undefined;
1723
1839
  breakExcuteIfEmpty?: boolean | undefined;
1724
1840
  }): this;
1725
- /** AND MATCH(key1, key2, key3) AGAINST (:value) */
1841
+ /** AND MATCH(key1, key2, key3...) AGAINST (:value) */
1726
1842
  match(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1727
1843
  paramName?: string | undefined;
1728
1844
  skipEmptyString?: boolean | undefined;
1729
1845
  breakExcuteIfEmpty?: boolean | undefined;
1730
1846
  }): this;
1731
- /** AND NOT MATCH(key1, key2, key3) AGAINST (:value) */
1847
+ /** AND NOT MATCH(key1, key2, key3...) AGAINST (:value) */
1732
1848
  notMatch(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1733
1849
  paramName?: string | undefined;
1734
1850
  skipEmptyString?: boolean | undefined;
1735
1851
  breakExcuteIfEmpty?: boolean | undefined;
1736
1852
  }): this;
1737
- /** AND MATCH(key1, key2, key3) AGAINST (:value) IN BOOLEAN MODE*/
1853
+ /** AND MATCH(key1, key2, key3...) AGAINST (:value) IN BOOLEAN MODE*/
1738
1854
  matchBoolean(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1739
1855
  paramName?: string | undefined;
1740
1856
  skipEmptyString?: boolean | undefined;
1741
1857
  breakExcuteIfEmpty?: boolean | undefined;
1742
1858
  }): this;
1743
- /** AND NOT MATCH(key1, key2, key3) AGAINST (:value) IN BOOLEAN MODE */
1859
+ /** AND NOT MATCH(key1, key2, key3...) AGAINST (:value) IN BOOLEAN MODE */
1744
1860
  notMatchBoolean(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1745
1861
  paramName?: string | undefined;
1746
1862
  skipEmptyString?: boolean | undefined;
1747
1863
  breakExcuteIfEmpty?: boolean | undefined;
1748
1864
  }): this;
1749
- /** AND MATCH(key1, key2, key3) AGAINST (:value) WITH QUERY EXPANSION*/
1865
+ /** AND MATCH(key1, key2, key3...) AGAINST (:value) WITH QUERY EXPANSION*/
1750
1866
  matchQuery(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1751
1867
  paramName?: string | undefined;
1752
1868
  skipEmptyString?: boolean | undefined;
1753
1869
  breakExcuteIfEmpty?: boolean | undefined;
1754
1870
  }): this;
1755
- /** AND NOT MATCH(key1, key2, key3) AGAINST (:value) WITH QUERY EXPANSION*/
1871
+ /** AND NOT MATCH(key1, key2, key3...) AGAINST (:value) WITH QUERY EXPANSION*/
1756
1872
  notMatchQuery(value: string, keys: (keyof T)[], { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1757
1873
  paramName?: string | undefined;
1758
1874
  skipEmptyString?: boolean | undefined;
1759
1875
  breakExcuteIfEmpty?: boolean | undefined;
1760
1876
  }): this;
1761
- /** AND NOT LOCATE(key, :value) > 0 */
1877
+ /** AND LOCATE(key, :value) > 0 */
1762
1878
  includes(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1763
1879
  paramName?: string | undefined;
1764
1880
  skipEmptyString?: boolean | undefined;
@@ -1770,6 +1886,18 @@ declare class StreamQuery<T extends object> {
1770
1886
  skipEmptyString?: boolean | undefined;
1771
1887
  breakExcuteIfEmpty?: boolean | undefined;
1772
1888
  }): this;
1889
+ /** AND LOCATE(:value, key) > 0 */
1890
+ includes2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1891
+ paramName?: string | undefined;
1892
+ skipEmptyString?: boolean | undefined;
1893
+ breakExcuteIfEmpty?: boolean | undefined;
1894
+ }): this;
1895
+ /** AND NOT LOCATE(:value, key) = 0 */
1896
+ notIncludes2(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1897
+ paramName?: string | undefined;
1898
+ skipEmptyString?: boolean | undefined;
1899
+ breakExcuteIfEmpty?: boolean | undefined;
1900
+ }): this;
1773
1901
  /** AND FIND_IN_SET(:value, key) */
1774
1902
  findInSet(key: keyof T, value: string | number, { paramName, skipEmptyString, breakExcuteIfEmpty }?: {
1775
1903
  paramName?: string | undefined;
@@ -1784,6 +1912,14 @@ declare class StreamQuery<T extends object> {
1784
1912
  }): this;
1785
1913
  and(fn: StreamQuery<T> | ((stream: StreamQuery<T>) => boolean | void)): this;
1786
1914
  or(fn: StreamQuery<T> | ((stream: StreamQuery<T>) => boolean | void)): this;
1915
+ /**
1916
+ * sql WHERE 查询语句拼接:注意若有JOIN,需要写明别名。本表别名为t.例如:
1917
+ * ```
1918
+ * where('t.name > :name', {name: 1});
1919
+ * where('(t.name > :name OR t.name <> :name)', {name: 1});
1920
+ * ```
1921
+ */
1922
+ where(sql: string, param?: Record<string, any>): this;
1787
1923
  /** SET key = IFNULL(key, 0) + :value */
1788
1924
  incr(key: keyof T, value?: number): this;
1789
1925
  /** GROUP BY key1, key2, ... */
@@ -1819,8 +1955,16 @@ declare class StreamQuery<T extends object> {
1819
1955
  groupName?: string;
1820
1956
  }): this;
1821
1957
  select(...key: (keyof T)[]): this;
1958
+ /**
1959
+ * sql查询语句拼接:注意若有JOIN,需要写明别名。本表别名为t.例如:
1960
+ * ```
1961
+ * select2('t.name, t.age, ISNULL(t.type, :type)', {type: 1});
1962
+ * select2('MAX(t.age) MAXAge');
1963
+ * ```
1964
+ */
1822
1965
  select2(sql: string, param?: Record<string, any>): this;
1823
1966
  update(key: keyof T, value: T[keyof T]): this;
1967
+ /** update语句拼接:注意若有JOIN,需要写明别名。本表别名为t */
1824
1968
  update2(sql: string, param?: Record<string, any>): this;
1825
1969
  updateT(t: Partial<T>): this;
1826
1970
  /** SET key = REPLACE(key, :valueToFind, :valueToReplace) */
@@ -1904,6 +2048,7 @@ declare class StreamQuery<T extends object> {
1904
2048
  }): number;
1905
2049
  private _where;
1906
2050
  private _;
2051
+ private _2;
1907
2052
  private __;
1908
2053
  private _null;
1909
2054
  private _key;
@@ -1913,8 +2058,11 @@ declare class StreamQuery<T extends object> {
1913
2058
  private _shift;
1914
2059
  private _match;
1915
2060
  private _pow;
2061
+ private _pow2;
1916
2062
  private _like;
2063
+ private _like2;
1917
2064
  private _includes;
2065
+ private _includes2;
1918
2066
  }
1919
2067
  /**
1920
2068
  获取REDIS客户端,
package/sql.js CHANGED
@@ -3497,7 +3497,7 @@ class StreamQuery {
3497
3497
  const paramKeys = {};
3498
3498
  for (const [key, value] of Object.entries(t)) {
3499
3499
  const pkey = `p${this._prefix}${this._index++}`;
3500
- this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} = :${pkey} `);
3500
+ this._wheres.push(`AND t.${this[_fields][String(key)]?.C2()} = :${pkey} `);
3501
3501
  this._param[pkey] = value;
3502
3502
  if (paramName) {
3503
3503
  paramKeys[key] = pkey;
@@ -3521,14 +3521,6 @@ class StreamQuery {
3521
3521
  eqWith(key1, key2) { return this._key(key1, key2, '='); }
3522
3522
  /** AND key1 <> key2 */
3523
3523
  notEqWith(key1, key2) { return this._key(key1, key2, '<>'); }
3524
- /** AND key REGEXP :regexp */
3525
- regexp(key, regexp, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._(key, regexp, 'REGEXP', { paramName, skipEmptyString: true, breakExcuteIfEmpty }); }
3526
- /** AND key NOT REGEXP :regexp */
3527
- notRegexp(key, regexp, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._(key, regexp, 'REGEXP', { paramName, skipEmptyString: true, not: 'NOT', breakExcuteIfEmpty }); }
3528
- /** AND (key1 << 8) + key2 = value */
3529
- shiftEq(key1, key2, value, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._shift(key1, key2, value, '=', { paramName, breakExcuteIfEmpty }); }
3530
- /** AND (key1 << 8) + key2 <> value */
3531
- shiftNotEq(key1, key2, value, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._shift(key1, key2, value, '<>', { paramName, breakExcuteIfEmpty }); }
3532
3524
  /** AND key > :value */
3533
3525
  grate(key, value, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._(key, value, '>', { paramName, skipEmptyString: true, breakExcuteIfEmpty }); }
3534
3526
  /** AND key >= :value */
@@ -3545,6 +3537,18 @@ class StreamQuery {
3545
3537
  lessWith(key1, key2) { return this._key(key1, key2, '<'); }
3546
3538
  /** AND key1 <= key2 */
3547
3539
  lessEqWith(key1, key2) { return this._key(key1, key2, '<='); }
3540
+ /** AND key REGEXP :regexp */
3541
+ regexp(key, regexp, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._(key, regexp, 'REGEXP', { paramName, skipEmptyString: true, breakExcuteIfEmpty }); }
3542
+ /** AND key NOT REGEXP :regexp */
3543
+ notRegexp(key, regexp, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._(key, regexp, 'REGEXP', { paramName, skipEmptyString: true, not: 'NOT', breakExcuteIfEmpty }); }
3544
+ /** AND :regexp REGEXP key */
3545
+ regexp2(key, regexp, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._2(key, regexp, 'REGEXP', { paramName, skipEmptyString: true, breakExcuteIfEmpty }); }
3546
+ /** AND :regexp NOT REGEXP key */
3547
+ notRegexp2(key, regexp, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._2(key, regexp, 'REGEXP', { paramName, skipEmptyString: true, not: 'NOT', breakExcuteIfEmpty }); }
3548
+ /** AND (key1 << 8) + key2 = value */
3549
+ shiftEq(key1, key2, value, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._shift(key1, key2, value, '=', { paramName, breakExcuteIfEmpty }); }
3550
+ /** AND (key1 << 8) + key2 <> value */
3551
+ shiftNotEq(key1, key2, value, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._shift(key1, key2, value, '<>', { paramName, breakExcuteIfEmpty }); }
3548
3552
  /** AND key LIKE CONCAT('%', :value, '%') */
3549
3553
  like(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, left: '%', right: '%', breakExcuteIfEmpty }); }
3550
3554
  /** AND key NOT LIKE CONCAT('%', :value, '%') */
@@ -3574,9 +3578,41 @@ class StreamQuery {
3574
3578
  /** AND key NOT GLOB CONCAT(:value, '%') 注意:GLOB是大小写敏感like*/
3575
3579
  notRightGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, right: '%', not: 'NOT', breakExcuteIfEmpty, op: 'GLOB' }); }
3576
3580
  /** AND key GLOB :value 注意:GLOB是大小写敏感like,这里不拼接%*/
3577
- PreciseGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, breakExcuteIfEmpty, op: 'GLOB' }); }
3581
+ preciseGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, breakExcuteIfEmpty, op: 'GLOB' }); }
3578
3582
  /** AND key NOT GLOB :value 注意:GLOB是大小写敏感like,这里不拼接%*/
3579
3583
  notPreciseGlob(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfEmpty, op: 'GLOB' }); }
3584
+ /** AND :value LIKE CONCAT('%', key, '%') */
3585
+ like2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, left: '%', right: '%', breakExcuteIfEmpty }); }
3586
+ /** AND :value NOT LIKE CONCAT('%', key, '%') */
3587
+ notLike2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, left: '%', right: '%', not: 'NOT', breakExcuteIfEmpty }); }
3588
+ /** AND :value NOT LIKE CONCAT('%', key) */
3589
+ leftLike2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, left: '%', breakExcuteIfEmpty }); }
3590
+ /** AND :value LIKE CONCAT('%', key) */
3591
+ notLeftLike2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, left: '%', not: 'NOT', breakExcuteIfEmpty }); }
3592
+ /** AND :value LIKE CONCAT(key, '%') */
3593
+ rightLike2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, right: '%', breakExcuteIfEmpty }); }
3594
+ /** AND :value NOT LIKE CONCAT(key, '%') */
3595
+ notRightLike2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, right: '%', not: 'NOT', breakExcuteIfEmpty }); }
3596
+ /** AND :value LIKE key 注意:不会拼接% */
3597
+ PreciseLike2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, breakExcuteIfEmpty }); }
3598
+ /** AND :value NOT LIKE key 注意:不会拼接%*/
3599
+ notPreciseLike2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfEmpty }); }
3600
+ /** AND :value GLOB CONCAT('%', key, '%') 注意:GLOB是大小写敏感like */
3601
+ glob2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, left: '%', right: '%', breakExcuteIfEmpty, op: 'GLOB' }); }
3602
+ /** AND :value NOT GLOB CONCAT('%', key, '%') 注意:GLOB是大小写敏感like*/
3603
+ notGlob2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, left: '%', right: '%', not: 'NOT', breakExcuteIfEmpty, op: 'GLOB' }); }
3604
+ /** AND :value GLOB CONCAT('%', key) 注意:GLOB是大小写敏感like*/
3605
+ leftGlob2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, left: '%', breakExcuteIfEmpty, op: 'GLOB' }); }
3606
+ /** AND :value NOT GLOB CONCAT('%', key) 注意:GLOB是大小写敏感like*/
3607
+ notLeftGlob2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, left: '%', not: 'NOT', breakExcuteIfEmpty, op: 'GLOB' }); }
3608
+ /** AND :value GLOB CONCAT(key, '%') 注意:GLOB是大小写敏感like*/
3609
+ rightGlob2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, right: '%', breakExcuteIfEmpty, op: 'GLOB' }); }
3610
+ /** AND :value NOT GLOB CONCAT(key, '%') 注意:GLOB是大小写敏感like*/
3611
+ notRightGlob2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, right: '%', not: 'NOT', breakExcuteIfEmpty, op: 'GLOB' }); }
3612
+ /** AND :value GLOB key 注意:GLOB是大小写敏感like,这里不拼接%*/
3613
+ preciseGlob2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, breakExcuteIfEmpty, op: 'GLOB' }); }
3614
+ /** AND :value NOT GLOB key 注意:GLOB是大小写敏感like,这里不拼接%*/
3615
+ notPreciseGlob2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._like2(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfEmpty, op: 'GLOB' }); }
3580
3616
  /** AND key IN (:value) */
3581
3617
  in(key, value, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._in(key, value, { paramName, breakExcuteIfEmpty }); }
3582
3618
  /** AND key NOT IN (:value) */
@@ -3591,12 +3627,12 @@ class StreamQuery {
3591
3627
  isNotNULL(key) { return this._null(key, 'NOT'); }
3592
3628
  /** AND (key IS NULL OR key = '') */
3593
3629
  isEmpty(key) {
3594
- this._wheres.push(`AND (${this[_fields][String(key)]?.C2()} IS NULL OR ${this[_fields][String(key)]?.C2()} = '')`);
3630
+ this._wheres.push(`AND (t.${this[_fields][String(key)]?.C2()} IS NULL OR t.${this[_fields][String(key)]?.C2()} = '')`);
3595
3631
  return this;
3596
3632
  }
3597
3633
  /** AND key IS NOT NULL AND key <> ''*/
3598
3634
  isNotEmpty(key) {
3599
- this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} IS NOT NULL AND ${this[_fields][String(key)]?.C2()} <> ''`);
3635
+ this._wheres.push(`AND t.${this[_fields][String(key)]?.C2()} IS NOT NULL AND t.${this[_fields][String(key)]?.C2()} <> ''`);
3600
3636
  return this;
3601
3637
  }
3602
3638
  /** AND key BETWEEN :value1 AND :value2 */
@@ -3607,26 +3643,34 @@ class StreamQuery {
3607
3643
  pow(key, value, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._pow(key, value, { paramName, breakExcuteIfEmpty }); }
3608
3644
  /** AND NOT POW(2, key) & :value */
3609
3645
  notPow(key, value, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._pow(key, value, { paramName, not: 'NOT', breakExcuteIfEmpty }); }
3646
+ /** AND POW(2, :value) & key */
3647
+ pow2(key, value, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._pow2(key, value, { paramName, breakExcuteIfEmpty }); }
3648
+ /** AND NOT POW(2, :value) & key */
3649
+ notPow2(key, value, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._pow2(key, value, { paramName, not: 'NOT', breakExcuteIfEmpty }); }
3610
3650
  /** AND POW(2, key1) & key2 */
3611
3651
  powWith(key, values, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._pow(key, add(...values.map(value => Math.pow(2, +value))), { paramName, breakExcuteIfEmpty }); }
3612
3652
  /** AND NOT POW(2, key1) & key2 */
3613
3653
  notPowWith(key, values, { paramName = '', breakExcuteIfEmpty = true } = {}) { return this._pow(key, add(...values.map(value => Math.pow(2, +value))), { paramName, not: 'NOT', breakExcuteIfEmpty }); }
3614
- /** AND MATCH(key1, key2, key3) AGAINST (:value) */
3654
+ /** AND MATCH(key1, key2, key3...) AGAINST (:value) */
3615
3655
  match(value, keys, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._match(value, keys, { paramName, skipEmptyString, breakExcuteIfEmpty }); }
3616
- /** AND NOT MATCH(key1, key2, key3) AGAINST (:value) */
3656
+ /** AND NOT MATCH(key1, key2, key3...) AGAINST (:value) */
3617
3657
  notMatch(value, keys, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._match(value, keys, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfEmpty }); }
3618
- /** AND MATCH(key1, key2, key3) AGAINST (:value) IN BOOLEAN MODE*/
3658
+ /** AND MATCH(key1, key2, key3...) AGAINST (:value) IN BOOLEAN MODE*/
3619
3659
  matchBoolean(value, keys, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._match(value, keys, { paramName, skipEmptyString, breakExcuteIfEmpty, append: 'IN BOOLEAN MODE' }); }
3620
- /** AND NOT MATCH(key1, key2, key3) AGAINST (:value) IN BOOLEAN MODE */
3660
+ /** AND NOT MATCH(key1, key2, key3...) AGAINST (:value) IN BOOLEAN MODE */
3621
3661
  notMatchBoolean(value, keys, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._match(value, keys, { paramName, skipEmptyString, breakExcuteIfEmpty, not: 'NOT', append: 'IN BOOLEAN MODE' }); }
3622
- /** AND MATCH(key1, key2, key3) AGAINST (:value) WITH QUERY EXPANSION*/
3662
+ /** AND MATCH(key1, key2, key3...) AGAINST (:value) WITH QUERY EXPANSION*/
3623
3663
  matchQuery(value, keys, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._match(value, keys, { paramName, skipEmptyString, breakExcuteIfEmpty, append: 'WITH QUERY EXPANSION' }); }
3624
- /** AND NOT MATCH(key1, key2, key3) AGAINST (:value) WITH QUERY EXPANSION*/
3664
+ /** AND NOT MATCH(key1, key2, key3...) AGAINST (:value) WITH QUERY EXPANSION*/
3625
3665
  notMatchQuery(value, keys, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._match(value, keys, { paramName, skipEmptyString, breakExcuteIfEmpty, not: 'NOT', append: 'WITH QUERY EXPANSION' }); }
3626
- /** AND NOT LOCATE(key, :value) > 0 */
3666
+ /** AND LOCATE(key, :value) > 0 */
3627
3667
  includes(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._includes(key, value, { paramName, skipEmptyString, breakExcuteIfEmpty }); }
3628
3668
  /** AND NOT LOCATE(key, :value) = 0 */
3629
3669
  notIncludes(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._includes(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfEmpty }); }
3670
+ /** AND LOCATE(:value, key) > 0 */
3671
+ includes2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._includes2(key, value, { paramName, skipEmptyString, breakExcuteIfEmpty }); }
3672
+ /** AND NOT LOCATE(:value, key) = 0 */
3673
+ notIncludes2(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) { return this._includes2(key, value, { paramName, skipEmptyString, not: 'NOT', breakExcuteIfEmpty }); }
3630
3674
  /** AND FIND_IN_SET(:value, key) */
3631
3675
  findInSet(key, value, { paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) {
3632
3676
  if (value === null
@@ -3642,7 +3686,7 @@ class StreamQuery {
3642
3686
  }
3643
3687
  else {
3644
3688
  const pkey = `p${this._prefix}${this._index++}`;
3645
- this._wheres.push(`AND FIND_IN_SET(:${pkey}, ${this[_fields][String(key)]?.C2()})`);
3689
+ this._wheres.push(`AND FIND_IN_SET(:${pkey}, t.${this[_fields][String(key)]?.C2()})`);
3646
3690
  this._param[pkey] = value;
3647
3691
  if (paramName) {
3648
3692
  this._paramKeys[paramName] = pkey;
@@ -3665,7 +3709,7 @@ class StreamQuery {
3665
3709
  }
3666
3710
  else {
3667
3711
  const pkey = `p${this._prefix}${this._index++}`;
3668
- this._wheres.push(`AND FIND_IN_SET(${this[_fields][String(key)]?.C2()}, :${pkey})`);
3712
+ this._wheres.push(`AND FIND_IN_SET(t.${this[_fields][String(key)]?.C2()}, :${pkey})`);
3669
3713
  this._param[pkey] = value;
3670
3714
  if (paramName) {
3671
3715
  this._paramKeys[paramName] = pkey;
@@ -3699,51 +3743,73 @@ class StreamQuery {
3699
3743
  }
3700
3744
  return this;
3701
3745
  }
3746
+ /**
3747
+ * sql WHERE 查询语句拼接:注意若有JOIN,需要写明别名。本表别名为t.例如:
3748
+ * ```
3749
+ * where('t.name > :name', {name: 1});
3750
+ * where('(t.name > :name OR t.name <> :name)', {name: 1});
3751
+ * ```
3752
+ */
3753
+ where(sql, param) {
3754
+ this._wheres.push(`AND ${sql}`);
3755
+ if (param) {
3756
+ Object.assign(this._param, param);
3757
+ }
3758
+ return this;
3759
+ }
3702
3760
  /** SET key = IFNULL(key, 0) + :value */
3703
3761
  incr(key, value = 1) {
3704
3762
  const pkey = `p${this._prefix}${this._index++}`;
3705
3763
  const keyName = this[_fields][String(key)]?.C2();
3706
- this._updateColumns.push(`${keyName} = IFNULL(${keyName}, 0) + :${pkey}`);
3764
+ this._updateColumns.push(`t.${keyName} = IFNULL(t.${keyName}, 0) + :${pkey}`);
3707
3765
  this._param[pkey] = value;
3708
3766
  return this;
3709
3767
  }
3710
3768
  /** GROUP BY key1, key2, ... */
3711
- groupBy(...keys) { this._groups.push(...keys.map(key => `${this[_fields][String(key)]?.C2()}`)); return this; }
3769
+ groupBy(...keys) { this._groups.push(...keys.map(key => `t.${this[_fields][String(key)]?.C2()}`)); return this; }
3712
3770
  /** GROUP BY key1, key2, ... */
3713
- groupBy2(...keys) { this._groups.push(...keys.map(key => `${this[_fields][String(key)]?.C2()}`)); return this; }
3771
+ groupBy2(...keys) { this._groups.push(...keys.map(key => `t.${this[_fields][String(key)]?.C2()}`)); return this; }
3714
3772
  /** ORDER BY key1 ASC, key2 ASC, ... */
3715
- asc(...keys) { this._orders.push(...keys.map(key => `${this[_fields][String(key)]?.C2()} ASC`)); return this; }
3773
+ asc(...keys) { this._orders.push(...keys.map(key => `t.${this[_fields][String(key)]?.C2()} ASC`)); return this; }
3716
3774
  /** ORDER BY key1 ASC, key2 ASC, ... */
3717
- asc2(...keys) { this._orders.push(...keys.map(key => `${this[_fields][String(key)]?.C2()} ASC`)); return this; }
3775
+ asc2(...keys) { this._orders.push(...keys.map(key => `t.${this[_fields][String(key)]?.C2()} ASC`)); return this; }
3718
3776
  /** ORDER BY key1 DESC, key2 DESC, ... */
3719
- desc(...keys) { this._orders.push(...keys.map(key => `${this[_fields][String(key)]?.C2()} DESC`)); return this; }
3777
+ desc(...keys) { this._orders.push(...keys.map(key => `t.${this[_fields][String(key)]?.C2()} DESC`)); return this; }
3720
3778
  /** ORDER BY key1 DESC, key2 DESC, ... */
3721
- desc2(...keys) { this._orders.push(...keys.map(key => `${this[_fields][String(key)]?.C2()} ASC`)); return this; }
3779
+ desc2(...keys) { this._orders.push(...keys.map(key => `t.${this[_fields][String(key)]?.C2()} ASC`)); return this; }
3722
3780
  /** LIMIT :startRow, :pageSize */
3723
3781
  limit(startRow, pageSize) { this._startRow = startRow; this._pageSize = pageSize; return this; }
3724
3782
  /** LIMIT ((:pageNumber || 1) - 1) * :pageSize, :pageSize */
3725
3783
  page(pageNumber, pageSize) { this._startRow = ((pageNumber || 1) - 1) * pageSize; this._pageSize = pageSize; return this; }
3726
3784
  distinct(on = true) { this._distinct = on; return this; }
3727
3785
  /** COUNT(DISTINCT key) */
3728
- countDistinct(key, countName) { this._columns.push(`COUNT(DISTINCT ${this[_fields][String(key)]?.C2()}) ${countName || `${this[_fields][String(key)]?.C2()}`}`); return this; }
3786
+ countDistinct(key, countName) { this._columns.push(`COUNT(DISTINCT t.${this[_fields][String(key)]?.C2()}) ${countName || `t.${this[_fields][String(key)]?.C2()}`}`); return this; }
3729
3787
  count(countName) { this._columns.push(`COUNT(1) ${countName ?? 'ct'}`); return this; }
3730
- sum(key, legName, distinct) { this._columns.push(`SUM(${distinct ? 'DISTINCT' : ''} ${this[_fields][String(key)]?.C2()}) ${legName || `${this[_fields][String(key)]?.C2()}`}`); return this; }
3731
- avg(key, legName, distinct) { this._columns.push(`AVG(${distinct ? 'DISTINCT' : ''} ${this[_fields][String(key)]?.C2()}) ${legName || `${this[_fields][String(key)]?.C2()}`}`); return this; }
3732
- max(key, legName, distinct) { this._columns.push(`MAX(${distinct ? 'DISTINCT' : ''} ${this[_fields][String(key)]?.C2()}) ${legName || `${this[_fields][String(key)]?.C2()}`}`); return this; }
3733
- min(key, legName, distinct) { this._columns.push(`MIN(${distinct ? 'DISTINCT' : ''} ${this[_fields][String(key)]?.C2()}) ${legName || `${this[_fields][String(key)]?.C2()}`}`); return this; }
3788
+ sum(key, legName, distinct) { this._columns.push(`SUM(${distinct ? 'DISTINCT' : ''} t.${this[_fields][String(key)]?.C2()}) ${legName || `t.${this[_fields][String(key)]?.C2()}`}`); return this; }
3789
+ avg(key, legName, distinct) { this._columns.push(`AVG(${distinct ? 'DISTINCT' : ''} t.${this[_fields][String(key)]?.C2()}) ${legName || `t.${this[_fields][String(key)]?.C2()}`}`); return this; }
3790
+ max(key, legName, distinct) { this._columns.push(`MAX(${distinct ? 'DISTINCT' : ''} t.${this[_fields][String(key)]?.C2()}) ${legName || `t.${this[_fields][String(key)]?.C2()}`}`); return this; }
3791
+ min(key, legName, distinct) { this._columns.push(`MIN(${distinct ? 'DISTINCT' : ''} t.${this[_fields][String(key)]?.C2()}) ${legName || `t.${this[_fields][String(key)]?.C2()}`}`); return this; }
3734
3792
  /** GROUP_CONCAT([DISTINCT] key [ORDER BY :asc ASC] [ORDER BY :asc DESC] [SEPARATOR :separator]) */
3735
3793
  groupConcat(key, param) {
3736
3794
  this._columns.push(`GROUP_CONCAT(
3737
- ${param && param.distinct ? 'DISTINCT' : ''} ${this[_fields][String(key)]?.C2()}
3738
- ${param && param.asc && param.asc.length > 0 ? `ORDER BY ${param.asc.map(i => `${this[_fields][String(i)]?.C2()} ASC`)} ` : ''}
3739
- ${param && param.desc && param.desc.length > 0 ? `${param && param.asc && param.asc.length > 0 ? '' : 'ORDER BY'} ${param.desc.map(i => `${this[_fields][String(i)]?.C2()} DESC`)} ` : ''}
3795
+ ${param && param.distinct ? 'DISTINCT' : ''} t.${this[_fields][String(key)]?.C2()}
3796
+ ${param && param.asc && param.asc.length > 0 ? `ORDER BY ${param.asc.map(i => `t.${this[_fields][String(i)]?.C2()} ASC`)} ` : ''}
3797
+ ${param && param.desc && param.desc.length > 0 ? `${param && param.asc && param.asc.length > 0 ? '' : 'ORDER BY'} ${param.desc.map(i => `t.${this[_fields][String(i)]?.C2()} DESC`)} ` : ''}
3740
3798
  SEPARATOR '${param && param.separator || ','}'
3741
- ) ${param && param.groupName || `${this[_fields][String(key)]?.C2()}`}`);
3799
+ ) ${param && param.groupName || `t.${this[_fields][String(key)]?.C2()}`}`);
3742
3800
  return this;
3743
3801
  }
3744
- select(...key) { this._columns.push(...(key.map(k => this[_fields][String(k)].C3()))); return this; }
3802
+ select(...key) { this._columns.push(...(key.map(k => `t.${this[_fields][String(k)].C3()}`))); return this; }
3803
+ /**
3804
+ * sql查询语句拼接:注意若有JOIN,需要写明别名。本表别名为t.例如:
3805
+ * ```
3806
+ * select2('t.name, t.age, ISNULL(t.type, :type)', {type: 1});
3807
+ * select2('MAX(t.age) MAXAge');
3808
+ * ```
3809
+ */
3745
3810
  select2(sql, param) { this._columns.push(`${sql}`); Object.assign(this._param, param); return this; }
3746
3811
  update(key, value) { this._updates ?? (this._updates = {}); this._updates[this[_fields][String(key)]?.C2()] = value; return this; }
3812
+ /** update语句拼接:注意若有JOIN,需要写明别名。本表别名为t */
3747
3813
  update2(sql, param) { this._updateColumns.push(sql); Object.assign(this._param, param); return this; }
3748
3814
  updateT(t) {
3749
3815
  this._updates ?? (this._updates = {});
@@ -3756,7 +3822,7 @@ class StreamQuery {
3756
3822
  /** SET key = REPLACE(key, :valueToFind, :valueToReplace) */
3757
3823
  replace(key, valueToFind, valueToReplace) {
3758
3824
  const [pkey1, pkey2] = [`p${this._prefix}${this._index++}`, `p${this._prefix}${this._index++}`];
3759
- this._updateColumns.push(` ${this[_fields][String(key)]?.C2()} = REPLACE(${this[_fields][String(key)]?.C2()}, :${pkey1}, :${pkey2}) `);
3825
+ this._updateColumns.push(` t.${this[_fields][String(key)]?.C2()} = REPLACE(t.${this[_fields][String(key)]?.C2()}, :${pkey1}, :${pkey2}) `);
3760
3826
  this._param[pkey1] = valueToFind;
3761
3827
  this._param[pkey2] = valueToReplace;
3762
3828
  return this;
@@ -3768,8 +3834,8 @@ class StreamQuery {
3768
3834
  const { where, params } = this._where();
3769
3835
  let sql = `
3770
3836
  SELECT
3771
- ${this._distinct ? 'DISTINCT' : ''} ${this._columns && this._columns.length > 0 ? this._columns.join(',') : this[_columns].map(key => this[_fields][String(key)]?.C3()).join(',')}
3772
- FROM ${option.tableName ?? this._service[_tableName]}
3837
+ ${this._distinct ? 'DISTINCT' : ''} ${this._columns && this._columns.length > 0 ? this._columns.join(',') : this[_columns].map(key => `t.${this[_fields][String(key)]?.C3()}`).join(',')}
3838
+ FROM ${option.tableName ?? this._service[_tableName]} t
3773
3839
  ${where ? ' WHERE ' : ''}
3774
3840
  ${where}
3775
3841
  ${this._groups.length > 0 ? `GROUP BY ${this._groups.join(',')} ` : ''}
@@ -3813,8 +3879,8 @@ class StreamQuery {
3813
3879
  };
3814
3880
  let sql = `
3815
3881
  SELECT
3816
- ${this._distinct ? 'DISTINCT' : ''} ${this._columns && this._columns.length > 0 ? this._columns.join(',') : this[_columns].map(key => this[_fields][String(key)]?.C3()).join(',')}
3817
- FROM ${option.tableName ?? this._service[_tableName]}
3882
+ ${this._distinct ? 'DISTINCT' : ''} ${this._columns && this._columns.length > 0 ? this._columns.join(',') : this[_columns].map(key => `t.${this[_fields][String(key)]?.C3()}`).join(',')}
3883
+ FROM ${option.tableName ?? this._service[_tableName]} t
3818
3884
  ${where ? ' WHERE ' : ''}
3819
3885
  ${where}
3820
3886
  ${this._groups.length > 0 ? `GROUP BY ${this._groups.join(',')} ` : ''}
@@ -3828,7 +3894,7 @@ class StreamQuery {
3828
3894
  }
3829
3895
  const sqlCount = `
3830
3896
  SELECT COUNT(1)
3831
- FROM ${option.tableName ?? this._service[_tableName]}
3897
+ FROM ${option.tableName ?? this._service[_tableName]} t
3832
3898
  ${where ? ' WHERE ' : ''}
3833
3899
  ${where}
3834
3900
  ${this._groups.length > 0 ? `GROUP BY ${this._groups.join(',')} ` : ''}
@@ -3894,12 +3960,12 @@ class StreamQuery {
3894
3960
  if (this._updates) {
3895
3961
  for (const [K, V] of Object.entries(this._updates)) {
3896
3962
  const pkey = `p${this._prefix}${this._index++}`;
3897
- sets.push(` ${K} = :${pkey} `);
3963
+ sets.push(` t.${K} = :${pkey} `);
3898
3964
  params[pkey] = V;
3899
3965
  }
3900
3966
  }
3901
3967
  if (sets.length > 0) {
3902
- const sql = `UPDATE ${option.tableName ?? this._service[_tableName]} SET ${sets.join(',')}
3968
+ const sql = `UPDATE ${option.tableName ?? this._service[_tableName]} t SET ${sets.join(',')}
3903
3969
  ${where ? ' WHERE ' : ''}
3904
3970
  ${where}
3905
3971
  `;
@@ -3918,15 +3984,20 @@ class StreamQuery {
3918
3984
  option ?? (option = {});
3919
3985
  option.sync ?? (option.sync = SyncMode.Async);
3920
3986
  const { where, params } = this._where();
3921
- // const sql = `DELETE FROM ${option.tableName ?? this._service[_tableName]}
3922
- // ${where ? ' WHERE ' : ''}
3923
- // ${where}
3924
- // `;
3987
+ const sql = `DELETE FROM ${option.tableName ?? this._service[_tableName]} t
3988
+ ${where ? ' WHERE ' : ''}
3989
+ ${where}
3990
+ `;
3991
+ // if (option.sync === SyncMode.Async) {
3992
+ // return this._service.delete({ ...option, sync: SyncMode.Async, whereSql: where, whereParams: params });
3993
+ // } else {
3994
+ // return this._service.delete({ ...option, sync: SyncMode.Sync, whereSql: where, whereParams: params });
3995
+ // }
3925
3996
  if (option.sync === SyncMode.Async) {
3926
- return this._service.delete({ ...option, sync: SyncMode.Async, whereSql: where, whereParams: params });
3997
+ return this._service.excute({ ...option, sync: SyncMode.Async, sql, params });
3927
3998
  }
3928
3999
  else {
3929
- return this._service.delete({ ...option, sync: SyncMode.Sync, whereSql: where, whereParams: params });
4000
+ return this._service.excute({ ...option, sync: SyncMode.Sync, sql, params });
3930
4001
  }
3931
4002
  }
3932
4003
  _where() {
@@ -3969,7 +4040,29 @@ class StreamQuery {
3969
4040
  }
3970
4041
  else {
3971
4042
  const pkey = `p${this._prefix}${this._index++}`;
3972
- this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} ${not} ${op} :${pkey} `);
4043
+ this._wheres.push(`AND t.${this[_fields][String(key)]?.C2()} ${not} ${op} :${pkey} `);
4044
+ this._param[pkey] = value;
4045
+ if (paramName) {
4046
+ this._paramKeys[paramName] = pkey;
4047
+ }
4048
+ }
4049
+ return this;
4050
+ }
4051
+ _2(key, value, op, { not = '', paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) {
4052
+ if (value === null
4053
+ || value === undefined
4054
+ || (emptyString(`${value ?? ''}`) && skipEmptyString)) {
4055
+ if (breakExcuteIfEmpty) {
4056
+ this.if_exec = false;
4057
+ }
4058
+ return this;
4059
+ }
4060
+ if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
4061
+ this._param[this._paramKeys[paramName]] = value;
4062
+ }
4063
+ else {
4064
+ const pkey = `p${this._prefix}${this._index++}`;
4065
+ this._wheres.push(`AND :${pkey} ${not} ${op} t.${this[_fields][String(key)]?.C2()}`);
3973
4066
  this._param[pkey] = value;
3974
4067
  if (paramName) {
3975
4068
  this._paramKeys[paramName] = pkey;
@@ -3991,7 +4084,7 @@ class StreamQuery {
3991
4084
  }
3992
4085
  else {
3993
4086
  const pkey = `p${this._prefix}${this._index++}`;
3994
- this._wheres.push(`AND (${keys.map(key => `${this[_fields][String(key)]?.C2()} ${not} ${op} :${pkey} `).join(' OR ')})`);
4087
+ this._wheres.push(`AND (${keys.map(key => `t.${this[_fields][String(key)]?.C2()} ${not} ${op} :${pkey} `).join(' OR ')})`);
3995
4088
  this._param[pkey] = value;
3996
4089
  if (paramName) {
3997
4090
  this._paramKeys[paramName] = pkey;
@@ -4000,11 +4093,11 @@ class StreamQuery {
4000
4093
  return this;
4001
4094
  }
4002
4095
  _null(key, not = '') {
4003
- this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} IS ${not} NULL`);
4096
+ this._wheres.push(`AND t.${this[_fields][String(key)]?.C2()} IS ${not} NULL`);
4004
4097
  return this;
4005
4098
  }
4006
4099
  _key(key1, key2, op, not = '') {
4007
- this._wheres.push(`AND ${this[_fields][String(key1)]?.C2()} ${not} ${op} ${this[_fields][String(key2)]?.C2()} `);
4100
+ this._wheres.push(`AND t.${this[_fields][String(key1)]?.C2()} ${not} ${op} t.${this[_fields][String(key2)]?.C2()} `);
4008
4101
  return this;
4009
4102
  }
4010
4103
  _between(key, value1, value2, { not = '', paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) {
@@ -4025,7 +4118,7 @@ class StreamQuery {
4025
4118
  }
4026
4119
  else {
4027
4120
  const [pkey1, pkey2] = [`p${this._prefix}${this._index++}`, `p${this._prefix}${this._index++}`];
4028
- this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} ${not} BETWEEN :${pkey1} AND :${pkey2}`);
4121
+ this._wheres.push(`AND t.${this[_fields][String(key)]?.C2()} ${not} BETWEEN :${pkey1} AND :${pkey2}`);
4029
4122
  this._param[pkey1] = value1;
4030
4123
  this._param[pkey2] = value2;
4031
4124
  if (paramName) {
@@ -4044,7 +4137,7 @@ class StreamQuery {
4044
4137
  }
4045
4138
  else {
4046
4139
  const pkey = `p${this._prefix}${this._index++}`;
4047
- this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} ${not} IN (:${pkey}) `);
4140
+ this._wheres.push(`AND t.${this[_fields][String(key)]?.C2()} ${not} IN (:${pkey}) `);
4048
4141
  this._param[pkey] = value;
4049
4142
  if (paramName) {
4050
4143
  this._paramKeys[paramName] = pkey;
@@ -4064,7 +4157,7 @@ class StreamQuery {
4064
4157
  }
4065
4158
  else {
4066
4159
  const pkey = `p${this._prefix}${this._index++}`;
4067
- this._wheres.push(`AND :${pkey} ${not} IN (${key.map(k => this[_fields][String(k)]?.C2()).join(',')}) `);
4160
+ this._wheres.push(`AND :${pkey} ${not} IN (${key.map(k => `t.${this[_fields][String(k)]?.C2()}`).join(',')}) `);
4068
4161
  this._param[pkey] = value;
4069
4162
  if (paramName) {
4070
4163
  this._paramKeys[paramName] = pkey;
@@ -4090,7 +4183,7 @@ class StreamQuery {
4090
4183
  }
4091
4184
  else {
4092
4185
  const pkey = `p${this._prefix}${this._index++}`;
4093
- this._wheres.push(`AND (${this[_fields][String(key1)]?.C2()} << 8) + ${this[_fields][String(key2)]?.C2()} ${not} ${op} :${pkey} `);
4186
+ this._wheres.push(`AND (t.${this[_fields][String(key1)]?.C2()} << 8) + t.${this[_fields][String(key2)]?.C2()} ${not} ${op} :${pkey} `);
4094
4187
  this._param[pkey] = value;
4095
4188
  if (paramName) {
4096
4189
  this._paramKeys[paramName] = pkey;
@@ -4112,7 +4205,7 @@ class StreamQuery {
4112
4205
  }
4113
4206
  else {
4114
4207
  const pkey = `p${this._prefix}${this._index++}`;
4115
- this._wheres.push(`AND ${not} MATCH(${keys.map(key => this[_fields][String(key)]?.C2()).join(',')}) AGAINST (:${pkey} ${append ?? ''})`);
4208
+ this._wheres.push(`AND ${not} MATCH(${keys.map(key => `t.${this[_fields][String(key)]?.C2()}`).join(',')}) AGAINST (:${pkey} ${append ?? ''})`);
4116
4209
  this._param[pkey] = value;
4117
4210
  if (paramName) {
4118
4211
  this._paramKeys[paramName] = pkey;
@@ -4134,7 +4227,29 @@ class StreamQuery {
4134
4227
  }
4135
4228
  else {
4136
4229
  const pkey = `p${this._prefix}${this._index++}`;
4137
- this._wheres.push(`AND ${not} POW(2, ${this[_fields][String(key)]?.C2()}) & :${pkey}`);
4230
+ this._wheres.push(`AND ${not} POW(2, t.${this[_fields][String(key)]?.C2()}) & :${pkey}`);
4231
+ this._param[pkey] = value;
4232
+ if (paramName) {
4233
+ this._paramKeys[paramName] = pkey;
4234
+ }
4235
+ }
4236
+ return this;
4237
+ }
4238
+ _pow2(key, value, { not = '', paramName = '', breakExcuteIfEmpty = true } = {}) {
4239
+ if (value === null
4240
+ || value === undefined
4241
+ || emptyString(`${value ?? ''}`)) {
4242
+ if (breakExcuteIfEmpty) {
4243
+ this.if_exec = false;
4244
+ }
4245
+ return this;
4246
+ }
4247
+ if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
4248
+ this._param[this._paramKeys[paramName]] = value;
4249
+ }
4250
+ else {
4251
+ const pkey = `p${this._prefix}${this._index++}`;
4252
+ this._wheres.push(`AND ${not} POW(2, :${pkey}) & t.${this[_fields][String(key)]?.C2()}`);
4138
4253
  this._param[pkey] = value;
4139
4254
  if (paramName) {
4140
4255
  this._paramKeys[paramName] = pkey;
@@ -4156,7 +4271,29 @@ class StreamQuery {
4156
4271
  }
4157
4272
  else {
4158
4273
  const pkey = `p${this._prefix}${this._index++}`;
4159
- this._wheres.push(`AND ${this[_fields][String(key)]?.C2()} ${not} ${op} CONCAT('${left}', :${pkey}, '${right}') `);
4274
+ this._wheres.push(`AND t.${this[_fields][String(key)]?.C2()} ${not} ${op} CONCAT('${left}', :${pkey}, '${right}') `);
4275
+ this._param[pkey] = value;
4276
+ if (paramName) {
4277
+ this._paramKeys[paramName] = pkey;
4278
+ }
4279
+ }
4280
+ return this;
4281
+ }
4282
+ _like2(key, value, { not = '', left = '', right = '', paramName = '', op = 'LIKE', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) {
4283
+ if (value === null
4284
+ || value === undefined
4285
+ || (emptyString(`${value ?? ''}`) && skipEmptyString)) {
4286
+ if (breakExcuteIfEmpty) {
4287
+ this.if_exec = false;
4288
+ }
4289
+ return this;
4290
+ }
4291
+ if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
4292
+ this._param[this._paramKeys[paramName]] = value;
4293
+ }
4294
+ else {
4295
+ const pkey = `p${this._prefix}${this._index++}`;
4296
+ this._wheres.push(`AND :${pkey} ${not} ${op} CONCAT('${left}',t.${this[_fields][String(key)]?.C2()}, '${right}') `);
4160
4297
  this._param[pkey] = value;
4161
4298
  if (paramName) {
4162
4299
  this._paramKeys[paramName] = pkey;
@@ -4178,7 +4315,29 @@ class StreamQuery {
4178
4315
  }
4179
4316
  else {
4180
4317
  const pkey = `p${this._prefix}${this._index++}`;
4181
- this._wheres.push(`AND LOCATE(${this[_fields][String(key)]?.C2()}, :${pkey}) ${not ? '=' : '>'} 0`);
4318
+ this._wheres.push(`AND LOCATE(t.${this[_fields][String(key)]?.C2()}, :${pkey}) ${not ? '=' : '>'} 0`);
4319
+ this._param[pkey] = value;
4320
+ if (paramName) {
4321
+ this._paramKeys[paramName] = pkey;
4322
+ }
4323
+ }
4324
+ return this;
4325
+ }
4326
+ _includes2(key, value, { not = '', paramName = '', skipEmptyString = true, breakExcuteIfEmpty = true } = {}) {
4327
+ if (value === null
4328
+ || value === undefined
4329
+ || (emptyString(`${value ?? ''}`) && skipEmptyString)) {
4330
+ if (breakExcuteIfEmpty) {
4331
+ this.if_exec = false;
4332
+ }
4333
+ return this;
4334
+ }
4335
+ if (paramName !== undefined && this._paramKeys.hasOwnProperty(paramName)) {
4336
+ this._param[this._paramKeys[paramName]] = value;
4337
+ }
4338
+ else {
4339
+ const pkey = `p${this._prefix}${this._index++}`;
4340
+ this._wheres.push(`AND LOCATE(:${pkey}, t.${this[_fields][String(key)]?.C2()}) ${not ? '=' : '>'} 0`);
4182
4341
  this._param[pkey] = value;
4183
4342
  if (paramName) {
4184
4343
  this._paramKeys[paramName] = pkey;
@@ -4232,75 +4391,87 @@ __decorate([
4232
4391
  __decorate([
4233
4392
  IF_PROCEED(),
4234
4393
  __metadata("design:type", Function),
4235
- __metadata("design:paramtypes", [Object, String, Object]),
4394
+ __metadata("design:paramtypes", [Object, Object, Object]),
4236
4395
  __metadata("design:returntype", void 0)
4237
- ], StreamQuery.prototype, "regexp", null);
4396
+ ], StreamQuery.prototype, "grate", null);
4238
4397
  __decorate([
4239
4398
  IF_PROCEED(),
4240
4399
  __metadata("design:type", Function),
4241
- __metadata("design:paramtypes", [Object, String, Object]),
4400
+ __metadata("design:paramtypes", [Object, Object, Object]),
4242
4401
  __metadata("design:returntype", void 0)
4243
- ], StreamQuery.prototype, "notRegexp", null);
4402
+ ], StreamQuery.prototype, "grateEq", null);
4244
4403
  __decorate([
4245
4404
  IF_PROCEED(),
4246
4405
  __metadata("design:type", Function),
4247
- __metadata("design:paramtypes", [Object, Object, Number, Object]),
4406
+ __metadata("design:paramtypes", [Object, Object]),
4248
4407
  __metadata("design:returntype", void 0)
4249
- ], StreamQuery.prototype, "shiftEq", null);
4408
+ ], StreamQuery.prototype, "grateWith", null);
4250
4409
  __decorate([
4251
4410
  IF_PROCEED(),
4252
4411
  __metadata("design:type", Function),
4253
- __metadata("design:paramtypes", [Object, Object, Number, Object]),
4412
+ __metadata("design:paramtypes", [Object, Object]),
4254
4413
  __metadata("design:returntype", void 0)
4255
- ], StreamQuery.prototype, "shiftNotEq", null);
4414
+ ], StreamQuery.prototype, "grateEqWith", null);
4256
4415
  __decorate([
4257
4416
  IF_PROCEED(),
4258
4417
  __metadata("design:type", Function),
4259
4418
  __metadata("design:paramtypes", [Object, Object, Object]),
4260
4419
  __metadata("design:returntype", void 0)
4261
- ], StreamQuery.prototype, "grate", null);
4420
+ ], StreamQuery.prototype, "less", null);
4262
4421
  __decorate([
4263
4422
  IF_PROCEED(),
4264
4423
  __metadata("design:type", Function),
4265
4424
  __metadata("design:paramtypes", [Object, Object, Object]),
4266
4425
  __metadata("design:returntype", void 0)
4267
- ], StreamQuery.prototype, "grateEq", null);
4426
+ ], StreamQuery.prototype, "lessEq", null);
4268
4427
  __decorate([
4269
4428
  IF_PROCEED(),
4270
4429
  __metadata("design:type", Function),
4271
4430
  __metadata("design:paramtypes", [Object, Object]),
4272
4431
  __metadata("design:returntype", void 0)
4273
- ], StreamQuery.prototype, "grateWith", null);
4432
+ ], StreamQuery.prototype, "lessWith", null);
4274
4433
  __decorate([
4275
4434
  IF_PROCEED(),
4276
4435
  __metadata("design:type", Function),
4277
4436
  __metadata("design:paramtypes", [Object, Object]),
4278
4437
  __metadata("design:returntype", void 0)
4279
- ], StreamQuery.prototype, "grateEqWith", null);
4438
+ ], StreamQuery.prototype, "lessEqWith", null);
4280
4439
  __decorate([
4281
4440
  IF_PROCEED(),
4282
4441
  __metadata("design:type", Function),
4283
- __metadata("design:paramtypes", [Object, Object, Object]),
4442
+ __metadata("design:paramtypes", [Object, String, Object]),
4284
4443
  __metadata("design:returntype", void 0)
4285
- ], StreamQuery.prototype, "less", null);
4444
+ ], StreamQuery.prototype, "regexp", null);
4286
4445
  __decorate([
4287
4446
  IF_PROCEED(),
4288
4447
  __metadata("design:type", Function),
4289
- __metadata("design:paramtypes", [Object, Object, Object]),
4448
+ __metadata("design:paramtypes", [Object, String, Object]),
4290
4449
  __metadata("design:returntype", void 0)
4291
- ], StreamQuery.prototype, "lessEq", null);
4450
+ ], StreamQuery.prototype, "notRegexp", null);
4292
4451
  __decorate([
4293
4452
  IF_PROCEED(),
4294
4453
  __metadata("design:type", Function),
4295
- __metadata("design:paramtypes", [Object, Object]),
4454
+ __metadata("design:paramtypes", [Object, String, Object]),
4296
4455
  __metadata("design:returntype", void 0)
4297
- ], StreamQuery.prototype, "lessWith", null);
4456
+ ], StreamQuery.prototype, "regexp2", null);
4298
4457
  __decorate([
4299
4458
  IF_PROCEED(),
4300
4459
  __metadata("design:type", Function),
4301
- __metadata("design:paramtypes", [Object, Object]),
4460
+ __metadata("design:paramtypes", [Object, String, Object]),
4302
4461
  __metadata("design:returntype", void 0)
4303
- ], StreamQuery.prototype, "lessEqWith", null);
4462
+ ], StreamQuery.prototype, "notRegexp2", null);
4463
+ __decorate([
4464
+ IF_PROCEED(),
4465
+ __metadata("design:type", Function),
4466
+ __metadata("design:paramtypes", [Object, Object, Number, Object]),
4467
+ __metadata("design:returntype", void 0)
4468
+ ], StreamQuery.prototype, "shiftEq", null);
4469
+ __decorate([
4470
+ IF_PROCEED(),
4471
+ __metadata("design:type", Function),
4472
+ __metadata("design:paramtypes", [Object, Object, Number, Object]),
4473
+ __metadata("design:returntype", void 0)
4474
+ ], StreamQuery.prototype, "shiftNotEq", null);
4304
4475
  __decorate([
4305
4476
  IF_PROCEED(),
4306
4477
  __metadata("design:type", Function),
@@ -4390,13 +4561,109 @@ __decorate([
4390
4561
  __metadata("design:type", Function),
4391
4562
  __metadata("design:paramtypes", [Object, Object, Object]),
4392
4563
  __metadata("design:returntype", void 0)
4393
- ], StreamQuery.prototype, "PreciseGlob", null);
4564
+ ], StreamQuery.prototype, "preciseGlob", null);
4394
4565
  __decorate([
4395
4566
  IF_PROCEED(),
4396
4567
  __metadata("design:type", Function),
4397
4568
  __metadata("design:paramtypes", [Object, Object, Object]),
4398
4569
  __metadata("design:returntype", void 0)
4399
4570
  ], StreamQuery.prototype, "notPreciseGlob", null);
4571
+ __decorate([
4572
+ IF_PROCEED(),
4573
+ __metadata("design:type", Function),
4574
+ __metadata("design:paramtypes", [Object, Object, Object]),
4575
+ __metadata("design:returntype", void 0)
4576
+ ], StreamQuery.prototype, "like2", null);
4577
+ __decorate([
4578
+ IF_PROCEED(),
4579
+ __metadata("design:type", Function),
4580
+ __metadata("design:paramtypes", [Object, Object, Object]),
4581
+ __metadata("design:returntype", void 0)
4582
+ ], StreamQuery.prototype, "notLike2", null);
4583
+ __decorate([
4584
+ IF_PROCEED(),
4585
+ __metadata("design:type", Function),
4586
+ __metadata("design:paramtypes", [Object, Object, Object]),
4587
+ __metadata("design:returntype", void 0)
4588
+ ], StreamQuery.prototype, "leftLike2", null);
4589
+ __decorate([
4590
+ IF_PROCEED(),
4591
+ __metadata("design:type", Function),
4592
+ __metadata("design:paramtypes", [Object, Object, Object]),
4593
+ __metadata("design:returntype", void 0)
4594
+ ], StreamQuery.prototype, "notLeftLike2", null);
4595
+ __decorate([
4596
+ IF_PROCEED(),
4597
+ __metadata("design:type", Function),
4598
+ __metadata("design:paramtypes", [Object, Object, Object]),
4599
+ __metadata("design:returntype", void 0)
4600
+ ], StreamQuery.prototype, "rightLike2", null);
4601
+ __decorate([
4602
+ IF_PROCEED(),
4603
+ __metadata("design:type", Function),
4604
+ __metadata("design:paramtypes", [Object, Object, Object]),
4605
+ __metadata("design:returntype", void 0)
4606
+ ], StreamQuery.prototype, "notRightLike2", null);
4607
+ __decorate([
4608
+ IF_PROCEED(),
4609
+ __metadata("design:type", Function),
4610
+ __metadata("design:paramtypes", [Object, Object, Object]),
4611
+ __metadata("design:returntype", void 0)
4612
+ ], StreamQuery.prototype, "PreciseLike2", null);
4613
+ __decorate([
4614
+ IF_PROCEED(),
4615
+ __metadata("design:type", Function),
4616
+ __metadata("design:paramtypes", [Object, Object, Object]),
4617
+ __metadata("design:returntype", void 0)
4618
+ ], StreamQuery.prototype, "notPreciseLike2", null);
4619
+ __decorate([
4620
+ IF_PROCEED(),
4621
+ __metadata("design:type", Function),
4622
+ __metadata("design:paramtypes", [Object, Object, Object]),
4623
+ __metadata("design:returntype", void 0)
4624
+ ], StreamQuery.prototype, "glob2", null);
4625
+ __decorate([
4626
+ IF_PROCEED(),
4627
+ __metadata("design:type", Function),
4628
+ __metadata("design:paramtypes", [Object, Object, Object]),
4629
+ __metadata("design:returntype", void 0)
4630
+ ], StreamQuery.prototype, "notGlob2", null);
4631
+ __decorate([
4632
+ IF_PROCEED(),
4633
+ __metadata("design:type", Function),
4634
+ __metadata("design:paramtypes", [Object, Object, Object]),
4635
+ __metadata("design:returntype", void 0)
4636
+ ], StreamQuery.prototype, "leftGlob2", null);
4637
+ __decorate([
4638
+ IF_PROCEED(),
4639
+ __metadata("design:type", Function),
4640
+ __metadata("design:paramtypes", [Object, Object, Object]),
4641
+ __metadata("design:returntype", void 0)
4642
+ ], StreamQuery.prototype, "notLeftGlob2", null);
4643
+ __decorate([
4644
+ IF_PROCEED(),
4645
+ __metadata("design:type", Function),
4646
+ __metadata("design:paramtypes", [Object, Object, Object]),
4647
+ __metadata("design:returntype", void 0)
4648
+ ], StreamQuery.prototype, "rightGlob2", null);
4649
+ __decorate([
4650
+ IF_PROCEED(),
4651
+ __metadata("design:type", Function),
4652
+ __metadata("design:paramtypes", [Object, Object, Object]),
4653
+ __metadata("design:returntype", void 0)
4654
+ ], StreamQuery.prototype, "notRightGlob2", null);
4655
+ __decorate([
4656
+ IF_PROCEED(),
4657
+ __metadata("design:type", Function),
4658
+ __metadata("design:paramtypes", [Object, Object, Object]),
4659
+ __metadata("design:returntype", void 0)
4660
+ ], StreamQuery.prototype, "preciseGlob2", null);
4661
+ __decorate([
4662
+ IF_PROCEED(),
4663
+ __metadata("design:type", Function),
4664
+ __metadata("design:paramtypes", [Object, Object, Object]),
4665
+ __metadata("design:returntype", void 0)
4666
+ ], StreamQuery.prototype, "notPreciseGlob2", null);
4400
4667
  __decorate([
4401
4668
  IF_PROCEED(),
4402
4669
  __metadata("design:type", Function),
@@ -4469,6 +4736,18 @@ __decorate([
4469
4736
  __metadata("design:paramtypes", [Object, Number, Object]),
4470
4737
  __metadata("design:returntype", void 0)
4471
4738
  ], StreamQuery.prototype, "notPow", null);
4739
+ __decorate([
4740
+ IF_PROCEED(),
4741
+ __metadata("design:type", Function),
4742
+ __metadata("design:paramtypes", [Object, Number, Object]),
4743
+ __metadata("design:returntype", void 0)
4744
+ ], StreamQuery.prototype, "pow2", null);
4745
+ __decorate([
4746
+ IF_PROCEED(),
4747
+ __metadata("design:type", Function),
4748
+ __metadata("design:paramtypes", [Object, Number, Object]),
4749
+ __metadata("design:returntype", void 0)
4750
+ ], StreamQuery.prototype, "notPow2", null);
4472
4751
  __decorate([
4473
4752
  IF_PROCEED(),
4474
4753
  __metadata("design:type", Function),
@@ -4529,6 +4808,18 @@ __decorate([
4529
4808
  __metadata("design:paramtypes", [Object, Object, Object]),
4530
4809
  __metadata("design:returntype", void 0)
4531
4810
  ], StreamQuery.prototype, "notIncludes", null);
4811
+ __decorate([
4812
+ IF_PROCEED(),
4813
+ __metadata("design:type", Function),
4814
+ __metadata("design:paramtypes", [Object, Object, Object]),
4815
+ __metadata("design:returntype", void 0)
4816
+ ], StreamQuery.prototype, "includes2", null);
4817
+ __decorate([
4818
+ IF_PROCEED(),
4819
+ __metadata("design:type", Function),
4820
+ __metadata("design:paramtypes", [Object, Object, Object]),
4821
+ __metadata("design:returntype", void 0)
4822
+ ], StreamQuery.prototype, "notIncludes2", null);
4532
4823
  __decorate([
4533
4824
  IF_PROCEED(),
4534
4825
  __metadata("design:type", Function),
@@ -4553,6 +4844,12 @@ __decorate([
4553
4844
  __metadata("design:paramtypes", [Object]),
4554
4845
  __metadata("design:returntype", void 0)
4555
4846
  ], StreamQuery.prototype, "or", null);
4847
+ __decorate([
4848
+ IF_PROCEED(),
4849
+ __metadata("design:type", Function),
4850
+ __metadata("design:paramtypes", [String, Object]),
4851
+ __metadata("design:returntype", void 0)
4852
+ ], StreamQuery.prototype, "where", null);
4556
4853
  __decorate([
4557
4854
  IF_PROCEED(),
4558
4855
  __metadata("design:type", Function),
package/test-mysql.js CHANGED
@@ -10,7 +10,7 @@ var __metadata = (this && this.__metadata) || function (k, v) {
10
10
  import { Field, SqlType } from 'baja-lite-field';
11
11
  import 'reflect-metadata';
12
12
  import { Boot } from './boot.js';
13
- import { ColumnMode, DB, SqlService } from './sql.js';
13
+ import { ColumnMode, DB, SelectResult, SqlService } from './sql.js';
14
14
  class BaseAuditUser {
15
15
  }
16
16
  __decorate([
@@ -78,12 +78,6 @@ 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
- }
87
81
  export async function go2() {
88
82
  await Boot({
89
83
  Mysql: {
@@ -106,10 +100,8 @@ export async function go2() {
106
100
  }
107
101
  });
108
102
  const service = new BaseAuditUserService();
109
- const data = await service.selectBatch({ sqlId: 'test.test', params: { realname: '张薇' } });
110
- console.log(11, data[0][0]?.userProvinceCode);
111
- console.log(11, data[1].length);
112
- const dd = select2();
103
+ const rt = await service.stream().eq('auditId', '100987125344341382').select('labelName').where('audit_id > 0').excuteSelect({ selectResult: SelectResult.R_C_Assert });
104
+ console.log(rt);
113
105
  // const list = await service.transaction<number>({
114
106
  // fn: async conn => {
115
107
  // await service.stream().eq('baseType', '0').in('auditId', ['162400829591265280', '162201628882247680']).excuteSelect();