function isWhereSubset(subset, superset): boolean;
function isWhereSubset(subset, superset): boolean;
Defined in: packages/db/src/query/predicate-utils.ts:21
Check if one where clause is a logical subset of another. Returns true if the subset predicate is more restrictive than (or equal to) the superset predicate.
The potentially more restrictive predicate
BasicExpression<boolean> | undefined
The potentially less restrictive predicate
BasicExpression<boolean> | undefined
boolean
true if subset logically implies superset
// age > 20 is subset of age > 10 (more restrictive)
isWhereSubset(gt(ref('age'), val(20)), gt(ref('age'), val(10))) // true
// age > 20 is subset of age > 10 (more restrictive)
isWhereSubset(gt(ref('age'), val(20)), gt(ref('age'), val(10))) // true
// age > 10 AND name = 'X' is subset of age > 10 (more conditions)
isWhereSubset(and(gt(ref('age'), val(10)), eq(ref('name'), val('X'))), gt(ref('age'), val(10))) // true
// age > 10 AND name = 'X' is subset of age > 10 (more conditions)
isWhereSubset(and(gt(ref('age'), val(10)), eq(ref('name'), val('X'))), gt(ref('age'), val(10))) // true
