Overview #
The query builder uses a recursive type system to represent arbitrarily nested filter conditions. The root Where type can contain AND/OR groups, each of which may hold field conditions or further nested groups.
Example Structure #
1
2
3
4
5
6
7
8
9
10
11
12
import type { Where } from "@lakeql/query-builder"
const filter: Where = {
and: [
{ status: { eq: "active" } },
{
or: [{ region: { eq: "us-east" } }, { region: { eq: "eu-west" } }],
},
{ amount: { gte: "100" } },
],
}
This produces SQL equivalent to:
1
2
3
4
WHERE "status" = 'active'
AND ("region" = 'us-east' OR "region" = 'eu-west')
AND "amount" >= '100'