Skip to content
Source
Sign inSign up
TanStack/db
Open History to see the last commit

toBooleanPredicate.md

34 lines794 Bytes

1---
2id: toBooleanPredicate
3title: toBooleanPredicate
4---
5​
6# Function: toBooleanPredicate()
7​
8```ts
9function toBooleanPredicate(result): boolean;
10```
11​
12Defined in: [packages/db/src/query/compiler/evaluators.ts:54](https://github.com/TanStack/db/blob/main/packages/db/src/query/compiler/evaluators.ts#L54)
13​
14Converts a 3-valued logic result to a boolean for use in WHERE/HAVING filters.
15In SQL, UNKNOWN (null) values in WHERE clauses exclude rows, matching false behavior.
16​
17## Parameters
18​
19### result
20​
21The 3-valued logic result: true, false, or null (UNKNOWN)
22​
23`boolean` | `null`
24​
25## Returns
26​
27`boolean`
28​
29true only if result is explicitly true, false otherwise
30​
31Truth table:
32- true → true (include row)
33- false → false (exclude row)
34- null (UNKNOWN) → false (exclude row, matching SQL behavior)