LakeQL
Overview
  • Introduction
Filtering
  • Where Interface
  • Operators
  • Combining Filters
Sorting and Paging
  • Sorting
  • Paging
  • API Reference
GitHub
LakeQL
  1. Query Builder
  2. Filtering
  3. Where Interface

On this page

  1. Overview
  2. Example Structure

Where Interface

The recursive type structure that represents filter conditions.

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'

Previous page

Filtering

Next page

Operators