Comparison operators available for filtering a single field. Only one operator should be set per FieldOptions object.
String operators compare the field value against the provided string. Boolean operators (is/isNot) check for equality with true/false.
Properties
| Name | Type |
|---|---|
| eq? | string |
| neq? | string |
| in? | string |
| notIn? | string |
| lt? | string |
| lte? | string |
| gt? | string |
| gte? | string |
| like? | string |
| notLike? | string |
| is? | boolean |
| isNot? | boolean |
Defines the sort order for a query result.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
TableDefinition | — | — |
The table type used to constrain the field to valid column names. See Introduction for details. | ||
Properties
| Name | Type |
|---|---|
| fieldRequired | SelectExpression<
KyselyDatabase<TableDefinition>,
keyof KyselyDatabase<TableDefinition>
> |
Column name to sort by. Constrained to valid column names from the table type. | |
| directionRequired | "asc" | "desc" |
Sort direction | |
Controls offset-based pagination.
Properties
| Name | Type |
|---|---|
| limit? | number |
Maximum number of rows to return. 100 | |
| offset? | number |
Number of rows to skip before fetching. | |
Parameters for generating a Trino-compatible SQL query from GraphQL resolve info.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
TableDefinition | — | — |
The table type definition used by Kysely for type-safe column references. See Introduction for details. | ||
Properties
| Name | Type |
|---|---|
| catalogRequired | string |
The Trino catalog name (e.g. “hive”). | |
| schemaRequired | string |
The Trino schema name (e.g. “sales”). | |
| tableRequired | string |
The table name to query. | |
| selectFieldsRequired | SelectExpression<
KyselyDatabase<TableDefinition>,
keyof KyselyDatabase<TableDefinition>
>[] |
The columns to select, derived from GraphQL field selections. | |
| userQueryRequired | Where |
The user-provided filter query (WHERE clause). | |
| paging? | PagingInput |
Pagination parameters (limit and offset). | |
| sortingRequired | SortInput<TableDefinition>[] |
Sort order definitions. | |
| transformFields? | Record<string, string> |
Maps GraphQL field names to database column names. | |
| dateFields? | string[] |
Fields that should be wrapped in to_unixtime() for date conversion. | |
Parameters for building a single field comparison expression.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
TableDefinition | — | — |
The table type definition. See Introduction for details. | ||
Properties
| Name | Type |
|---|---|
| ebRequired | ExpressionBuilder<KyselyDatabase<TableDefinition>, "tablename"> |
The Kysely expression builder for constructing SQL expressions. | |
| fieldNameRequired | string |
The column name to filter on. | |
| operatorRequired | string |
The comparison operator (eq, neq, lt, like, etc.). | |
| valueRequired | unknown |
The value to compare against. | |
Parameters for formatting a compiled SQL query.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
T | — | — |
Properties
| Name | Type |
|---|---|
| queryRequired | CompiledQuery<T> |
The compiled Kysely query to format. | |
Properties
| Name | Type |
|---|---|
| graphqlInfoRequired | GraphQLResolveInfo |
The GraphQL resolve info from the resolver. | |
| withNodes? | boolean |
When true, looks inside the nodes selection (for Connection types). false | |
A single field condition — a record where the key is the field name and the value is a FieldOptions object describing the comparison.
A recursive filter structure that can contain AND/OR groups, each holding field conditions or further nested groups.
Builds a single field comparison expression for use in WHERE clauses.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
TableDefinition | — | — |
Parameters
| Name | Type |
|---|---|
| getFieldQueryPropsRequired | GetFieldQueryProps<TableDefinition> |
Returns
ExpressionWrapper<
KyselyDatabase<TableDefinition>,
"tablename",
SqlBool
>A Kysely ExpressionWrapper representing the comparison.
Normalizes filter objects by ensuring each field is in its own object within and/or arrays.
Splits multi-field filter objects into separate entries so the query builder can process each field condition independently.
Parameters
| Name | Type |
|---|---|
| filterRequired | Where |
The filter object to normalize. | |
Returns
WhereA normalized filter with individual field entries.
Wraps bare field-level filters into an AND-rooted structure.
If the query already has a single and or or key at the root, it is returned as-is. Otherwise, all entries are combined under an and key.
Parameters
| Name | Type |
|---|---|
| userQueryRequired | Where |
The user-provided filter query. | |
Returns
WhereA normalized query with a logical operator at the root.
Generates a compiled SQL query with pagination metadata for Trino.
The query uses two CTEs internally:
- total_count — provides total_records (total matching rows before paging)
- records — the actual rows based on selectFields , filtering, sorting, and paging
The compiled query is executed by the Trino client which returns the row data.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
TableDefinition | — | — |
Parameters
| Name | Type |
|---|---|
| generateQueryPropsRequired | GenerateQueryProps<TableDefinition> |
Returns
CompiledQuery<{ total_records: number; }>A CompiledQuery ready for execution via the Trino client.
Formats a compiled SQL query for readability.
Applies uppercase keywords, PostgreSQL dialect, and interpolates parameters.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
T | — | — |
Parameters
| Name | Type |
|---|---|
| formatQueryPropsRequired | FormatQueryProps<T> |
Returns
stringThe formatted SQL string with interpolated parameters.
Extracts selected field names from a GraphQL resolve info object.
Type Parameters
| Parameter | Constraint | Default |
|---|---|---|
T | — | — |
Parameters
| Name | Type |
|---|---|
| getSelectFieldPropsRequired | GetSelectFieldProps |
Returns
SelectExpression<KyselyDatabase<T>, "tablename">[]An array of field names to use as SELECT columns.
Logical operators for combining filter conditions.
| Name | Type |
|---|---|
| AND | "and" |
| OR | "or" |