imodel-pg 0.19.0 → 0.19.1
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/index.d.mts +1 -1
- package/index.mjs +23 -1
- package/package.json +1 -1
package/index.d.mts
CHANGED
package/index.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* imodel v0.19.
|
|
2
|
+
* imodel v0.19.1
|
|
3
3
|
* (c) 2019-2026 undefined
|
|
4
4
|
* @license undefined
|
|
5
5
|
*/
|
|
@@ -600,6 +600,17 @@ function buildWhere(env, wheres) {
|
|
|
600
600
|
}
|
|
601
601
|
return Sql`(${Sql` OR `.glue(...orList)})`;
|
|
602
602
|
}
|
|
603
|
+
if (where.exists) {
|
|
604
|
+
const {
|
|
605
|
+
subquery,
|
|
606
|
+
not
|
|
607
|
+
} = where;
|
|
608
|
+
const select = buildSelect(env, subquery);
|
|
609
|
+
if (!select) {
|
|
610
|
+
return null;
|
|
611
|
+
}
|
|
612
|
+
return not ? Sql`NOT EXISTS(${select})` : Sql`EXISTS(${select})`;
|
|
613
|
+
}
|
|
603
614
|
const {
|
|
604
615
|
field: k,
|
|
605
616
|
operator: o,
|
|
@@ -650,6 +661,11 @@ function buildWhere(env, wheres) {
|
|
|
650
661
|
not = !not;
|
|
651
662
|
operator = 'IN';
|
|
652
663
|
break;
|
|
664
|
+
case 'NOTANY':
|
|
665
|
+
not = !not;
|
|
666
|
+
case 'ANY':
|
|
667
|
+
operator = 'ANY';
|
|
668
|
+
break;
|
|
653
669
|
case 'NOTLIKE':
|
|
654
670
|
not = !not;
|
|
655
671
|
operator = 'LIKE';
|
|
@@ -716,6 +732,12 @@ function buildWhere(env, wheres) {
|
|
|
716
732
|
if (!subquery?.length && Array.isArray(v) && (operator === 'IN' || operator === 'NOT IN') && v.length) {
|
|
717
733
|
values = Sql(['(', ...Array(v.length - 1).fill(','), ')'], ...v.map(v => v ?? null));
|
|
718
734
|
}
|
|
735
|
+
if (operator === 'ANY') {
|
|
736
|
+
if (!not) {
|
|
737
|
+
return Sql`${values} = ANY(${toField(k)})`;
|
|
738
|
+
}
|
|
739
|
+
return Sql`not(${values} = ANY(${toField(k)}))`;
|
|
740
|
+
}
|
|
719
741
|
if (!not) {
|
|
720
742
|
return Sql`${toField(k)} ${Sql(operator)} ${values}`;
|
|
721
743
|
}
|