本页还没有译文
本页 15 段还没译成Русский,下面显示的是英文原文。extractSimpleComparisons
还没翻译译自英文(tanstack.com)本页 15 段都还没译
function extractSimpleComparisons(expr): SimpleComparison[];Defined in: packages/db/src/query/expression-helpers.ts:337
Extracts all simple comparisons from a WHERE expression. This is useful for simple APIs that only support basic filters.
Note: This only works for simple AND-ed conditions and NOT-wrapped comparisons. Throws an error if it encounters unsupported operations like OR or complex nested expressions.
NOT operators are flattened by prefixing the operator name (e.g., not(eq(...)) becomes not_eq).
Parameters
expr
The WHERE expression to parse
BasicExpression<boolean> | null | undefined
Returns
Array of simple comparisons
Throws
Error if expression contains OR or other unsupported operations
Example
const comparisons = extractSimpleComparisons(where)
// Returns: [
// { field: ['category'], operator: 'eq', value: 'electronics' },
// { field: ['price'], operator: 'lt', value: 100 },
// { field: ['email'], operator: 'isNull' }, // No value for null checks
// { field: ['status'], operator: 'not_eq', value: 'archived' }
// ]AI 翻译查看英文原文