File: isWhereSubset.md | Updated: 11/15/2025
Search...
+ K
Auto
Docs Examples GitHub Contributors
Docs Examples GitHub Contributors
Docs Examples GitHub Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Docs Examples Github Contributors
Maintainers Partners Support Learn StatsBETA Discord Merch Blog GitHub Ethos Brand Guide
Documentation
Framework
React
Version
Latest
Search...
+ K
Menu
Getting Started
Guides
Collections
Frameworks
Community
API Reference
Framework
React
Version
Latest
Menu
Getting Started
Guides
Collections
Frameworks
Community
API Reference
On this page
Copy Markdown
Function: isWhereSubset()
=========================
ts
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.
Parameters
----------
### subset
The potentially more restrictive predicate
BasicExpression <boolean> | undefined
The potentially less restrictive predicate
BasicExpression <boolean> | undefined
boolean
true if subset logically implies superset
ts
// 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
ts
// 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
