baja-lite 1.3.35 → 1.3.37

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/package.json +1 -1
  2. package/sql.d.ts +1 -0
  3. package/sql.js +13 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baja-lite",
3
- "version": "1.3.35",
3
+ "version": "1.3.37",
4
4
  "description": "some util for self",
5
5
  "homepage": "https://github.com/void-soul/util-man",
6
6
  "repository": {
package/sql.d.ts CHANGED
@@ -1601,6 +1601,7 @@ declare class StreamQuery<T extends object> {
1601
1601
  }): this;
1602
1602
  and(fn: StreamQuery<T> | ((stream: StreamQuery<T>) => boolean | void)): this;
1603
1603
  or(fn: StreamQuery<T> | ((stream: StreamQuery<T>) => boolean | void)): this;
1604
+ incr(key: keyof T, value?: number): this;
1604
1605
  groupBy(...keys: (keyof T)[]): this;
1605
1606
  groupBy2(...keys: string[]): this;
1606
1607
  asc(...keys: (keyof T)[]): this;
package/sql.js CHANGED
@@ -3514,6 +3514,13 @@ class StreamQuery {
3514
3514
  }
3515
3515
  return this;
3516
3516
  }
3517
+ incr(key, value = 1) {
3518
+ const pkey = `p${this._prefix}${this._index++}`;
3519
+ const keyName = this[_fields][String(key)]?.C2();
3520
+ this._updateColumns.push(`${keyName} = IFNULL(${keyName}, 0) + :${pkey}`);
3521
+ this._param[pkey] = value;
3522
+ return this;
3523
+ }
3517
3524
  groupBy(...keys) { this._groups.push(...keys.map(key => `${this[_fields][String(key)]?.C2()}`)); return this; }
3518
3525
  groupBy2(...keys) { this._groups.push(...keys.map(key => `${this[_fields][String(key)]?.C2()}`)); return this; }
3519
3526
  asc(...keys) { this._orders.push(...keys.map(key => `${this[_fields][String(key)]?.C2()} ASC`)); return this; }
@@ -4329,6 +4336,12 @@ __decorate([
4329
4336
  __metadata("design:paramtypes", [Object]),
4330
4337
  __metadata("design:returntype", void 0)
4331
4338
  ], StreamQuery.prototype, "or", null);
4339
+ __decorate([
4340
+ IF_PROCEED(),
4341
+ __metadata("design:type", Function),
4342
+ __metadata("design:paramtypes", [Object, Object]),
4343
+ __metadata("design:returntype", void 0)
4344
+ ], StreamQuery.prototype, "incr", null);
4332
4345
  __decorate([
4333
4346
  IF_PROCEED(),
4334
4347
  __metadata("design:type", Function),