Command Palette

Search for a command to run...

Filtering & Sorting

Filter, sort, and paginate queries. These options work the same in both the server client and the hooks.

Filter Structure

example.ts
1 2 3 4 5 6 7 8 9 10 filter: { query: [{ condition: { field: 'name', operator: 'equal', value: 'Acme Corp', }, }], sortby: [{ field: 'created_at', order: 'desc' }], }

Operators

String

OperatorDescriptionExample value
equalExact match"value"
notEqualNot equal"value"
likePattern match (case-sensitive)"%search%"
ilikePattern match (case-insensitive)"%search%"
notLikeNot pattern match"%exclude%"
notiLikeNot pattern match (case-insensitive)"%exclude%"
startsWithStarts with"prefix"
endsWithEnds with"suffix"

Number & Date

OperatorDescription
equalEqual to
notEqualNot equal to
greaterThanGreater than
lessThanLess than
greaterThanOrEqualGreater than or equal
lessThanOrEqualLess than or equal

Null & Empty

OperatorDescription
isNullField is null
isNotNullField is not null
isEmptyEmpty string
isNotEmptyNot empty

These operators don't require a value.

Boolean

OperatorDescription
isTrueField is true
isFalseField is false

List

OperatorDescription
inValue in list
notInValue not in list

Use values instead of value for list operators:

example.ts
1 2 3 4 5 condition: { field: 'status', operator: 'in', values: ['paid', 'pending'], }

AND / OR

AND — all conditions must match:

example.ts
1 2 3 4 5 6 7 8 filter: { query: [{ and: [ { condition: { field: 'amount_net', operator: 'greaterThan', value: '1000' } }, { condition: { field: 'status', operator: 'equal', value: 'paid' } }, ], }], }

OR — any condition can match:

example.ts
1 2 3 4 5 6 7 8 filter: { query: [{ or: [ { condition: { field: 'name', operator: 'ilike', value: '%acme%' } }, { condition: { field: 'name', operator: 'ilike', value: '%corp%' } }, ], }], }

Sorting

example.ts
1 2 3 4 5 6 filter: { sortby: [ { field: 'created_at', order: 'desc' }, { field: 'name', order: 'asc' }, ], }

Multiple sort fields are applied in order (primary sort first).

Pagination

example.ts
1 2 3 4 pagination: { page: 1, // Page number (1-indexed) per_page: 20, // Items per page }

Response includes:

FieldTypeDescription
totalnumberTotal number of matching entities
current_pagenumberCurrent page number
per_pagenumberItems per page
last_pagenumberLast available page number
has_more_pagesbooleanWhether more pages exist