MCPcopy Create free account
hub / github.com/TanStack/db / extractComparisonField

Function extractComparisonField

packages/db/src/query/predicate-utils.ts:1195–1211  ·  view source on GitHub ↗
(func: Func)

Source from the content-addressed store, hash-verified

1193}
1194
1195function extractComparisonField(func: Func): ComparisonField | null {
1196 // Handle comparison operators: eq, gt, gte, lt, lte
1197 if ([`eq`, `gt`, `gte`, `lt`, `lte`].includes(func.name)) {
1198 // Assume first arg is ref, second is value
1199 const firstArg = func.args[0]
1200 const secondArg = func.args[1]
1201
1202 if (firstArg?.type === `ref` && secondArg?.type === `val`) {
1203 return {
1204 ref: firstArg,
1205 value: secondArg.value,
1206 }
1207 }
1208 }
1209
1210 return null
1211}
1212
1213function extractEqualityField(func: Func): ComparisonField | null {
1214 if (func.name === `eq`) {

Callers 6

isWhereSubsetInternalFunction · 0.85
minusSameFieldPredicatesFunction · 0.85
minusRangePredicatesFunction · 0.85
groupPredicatesByFieldFunction · 0.85
unionSameFieldPredicatesFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected