baja-lite 1.5.19 → 1.5.21
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/README.md +1 -0
- package/code.js +198 -120
- package/index.d.ts +0 -1
- package/index.js +0 -1
- package/package.json +1 -1
- package/sql.d.ts +176 -28
- package/sql.js +382 -85
- package/test-mysql.js +3 -11
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
|
|
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
|
-
|
|
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 (
|
|
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
|
|
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
|
|
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},
|
|
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(
|
|
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(
|
|
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 =>
|
|
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 =>
|
|
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 =>
|
|
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 =>
|
|
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 =>
|
|
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 =>
|
|
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
|
|
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' : ''}
|
|
3731
|
-
avg(key, legName, distinct) { this._columns.push(`AVG(${distinct ? 'DISTINCT' : ''}
|
|
3732
|
-
max(key, legName, distinct) { this._columns.push(`MAX(${distinct ? 'DISTINCT' : ''}
|
|
3733
|
-
min(key, legName, distinct) { this._columns.push(`MIN(${distinct ? 'DISTINCT' : ''}
|
|
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' : ''}
|
|
3738
|
-
${param && param.asc && param.asc.length > 0 ? `ORDER BY ${param.asc.map(i =>
|
|
3739
|
-
${param && param.desc && param.desc.length > 0 ? `${param && param.asc && param.asc.length > 0 ? '' : 'ORDER BY'} ${param.desc.map(i =>
|
|
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 ||
|
|
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(`
|
|
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(`
|
|
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
|
-
|
|
3922
|
-
|
|
3923
|
-
|
|
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.
|
|
3997
|
+
return this._service.excute({ ...option, sync: SyncMode.Async, sql, params });
|
|
3927
3998
|
}
|
|
3928
3999
|
else {
|
|
3929
|
-
return this._service.
|
|
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
|
|
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 =>
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 (
|
|
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,
|
|
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
|
|
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(
|
|
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,
|
|
4394
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
4236
4395
|
__metadata("design:returntype", void 0)
|
|
4237
|
-
], StreamQuery.prototype, "
|
|
4396
|
+
], StreamQuery.prototype, "grate", null);
|
|
4238
4397
|
__decorate([
|
|
4239
4398
|
IF_PROCEED(),
|
|
4240
4399
|
__metadata("design:type", Function),
|
|
4241
|
-
__metadata("design:paramtypes", [Object,
|
|
4400
|
+
__metadata("design:paramtypes", [Object, Object, Object]),
|
|
4242
4401
|
__metadata("design:returntype", void 0)
|
|
4243
|
-
], StreamQuery.prototype, "
|
|
4402
|
+
], StreamQuery.prototype, "grateEq", null);
|
|
4244
4403
|
__decorate([
|
|
4245
4404
|
IF_PROCEED(),
|
|
4246
4405
|
__metadata("design:type", Function),
|
|
4247
|
-
__metadata("design:paramtypes", [Object, Object
|
|
4406
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
4248
4407
|
__metadata("design:returntype", void 0)
|
|
4249
|
-
], StreamQuery.prototype, "
|
|
4408
|
+
], StreamQuery.prototype, "grateWith", null);
|
|
4250
4409
|
__decorate([
|
|
4251
4410
|
IF_PROCEED(),
|
|
4252
4411
|
__metadata("design:type", Function),
|
|
4253
|
-
__metadata("design:paramtypes", [Object, Object
|
|
4412
|
+
__metadata("design:paramtypes", [Object, Object]),
|
|
4254
4413
|
__metadata("design:returntype", void 0)
|
|
4255
|
-
], StreamQuery.prototype, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
4438
|
+
], StreamQuery.prototype, "lessEqWith", null);
|
|
4280
4439
|
__decorate([
|
|
4281
4440
|
IF_PROCEED(),
|
|
4282
4441
|
__metadata("design:type", Function),
|
|
4283
|
-
__metadata("design:paramtypes", [Object,
|
|
4442
|
+
__metadata("design:paramtypes", [Object, String, Object]),
|
|
4284
4443
|
__metadata("design:returntype", void 0)
|
|
4285
|
-
], StreamQuery.prototype, "
|
|
4444
|
+
], StreamQuery.prototype, "regexp", null);
|
|
4286
4445
|
__decorate([
|
|
4287
4446
|
IF_PROCEED(),
|
|
4288
4447
|
__metadata("design:type", Function),
|
|
4289
|
-
__metadata("design:paramtypes", [Object,
|
|
4448
|
+
__metadata("design:paramtypes", [Object, String, Object]),
|
|
4290
4449
|
__metadata("design:returntype", void 0)
|
|
4291
|
-
], StreamQuery.prototype, "
|
|
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, "
|
|
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, "
|
|
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, "
|
|
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),
|