Internal
Use query() or createQuery() instead of constructing directly.
Optionalalias: stringReadonly Internal[Type-only fluent return constructor.
Readonly Internal[Type-only ordered argument contract.
Readonly Internal[Nominal identity for typed child-query customizers.
ReadonlyrowRuntime structural schema; stable across filters, pagination and transaction clones.
True only when rows retain their complete entity shape.
Internal
Compiled SELECT protocol; never replays consumer callbacks.
ProtectedaddExplicit AND spelling of where(), including groups and typed parameters.
Explicit AND spelling of where(), including groups and typed parameters.
Explicit AND spelling of where(), including groups and typed parameters.
Explicit AND spelling of where(), including groups and typed parameters.
Configure an isolated Knex SELECT once, declaring the complete raw row output.
Internal
Reject writes through projections or loaded relations.
Select a typed AVG result on a new query.
Average non-null values in an unpaginated clone of this query.
Numeric schema property to aggregate.
Optionaloptions: AggregateOptions<O>
Optional parser receiving the raw driver result, including null.
Exact database numeric text or null by default; a parser overrides this.
Insert in parameter-safe chunks, retaining schema hooks and conflict handling.
Internal
Compile a bound SQL statement; callers never receive the mutable builder.
Optionalcorrelate: ReadCorrelationOptionalmode: typeof COMPILE_PARAMETERSSelect a typed COUNT result on a new query.
Optionalcolumn: ReadPredicateSelector<ReadColumns<S, keyof Relations>>Select a typed COUNTDISTINCT result on a new query.
Count distinct non-null values in an unpaginated clone of this query.
Schema property to count; SQL nulls do not contribute.
Optionaloptions: AggregateOptions<O>
Optional parser replacing default safe-integer conversion.
A safe integer, or the parser's inferred output type.
Count matching rows, or non-null column values, without mutating this query. Ignores source ordering/limits/offsets while retaining filters and transactions.
Optionaloptions: AggregateOptions<O>
Optional output parser; receives the raw driver value.
A safe integer by default, including zero for an empty source.
Count non-null column values without mutating the source query. Source paging/order is ignored; filters, scopes and transactions remain.
Mapped schema property to count.
Optionaloptions: AggregateOptions<O>
Optional parser replacing safe-integer decoding.
Internal
Decode a SQL/JSON row using the same metadata exposed to consumers.
Optionalpath: stringSelect a property subset and eliminate duplicate rows on that immutable projection.
Execute one statement and decode its selected row graph.
Execute a limited copy, returning undefined when no row matches.
Group rows before typed aggregate projection.
Filter groups by a mapped column comparison.
Load a declared relation in the same SQL statement. Return the customized child query so its selected fields and nested includes remain strongly typed.
Optionalcustomize: (Internal
Reuse a captured child query across polymorphic parent branches.
Join a typed collection, applying child projection and pagination independently per parent.
Optionalcustomize: (Join one typed nested object with explicit property keys, including nullable joins.
Optionalcustomize: (Select a typed MAX result on a new query.
Find the largest non-null column value without retaining source paging.
Schema property to aggregate.
Optionaloptions: AggregateOptions<O>
Optional parser replacing default decoding, including null handling.
Null for empty/all-null input; otherwise the column representation. Dates return Date; numeric SQL overrides may return exact strings.
Select a typed MIN result on a new query.
Find the smallest non-null column value without retaining source paging.
Schema property to aggregate.
Optionaloptions: AggregateOptions<O>
Optional parser replacing default decoding, including null handling.
Null for empty/all-null input; otherwise the column representation. Dates return Date; numeric SQL overrides may return exact strings.
Order parent rows independently of any child relation's ordering.
Optionaldirection: "desc" | "asc"Add an OR comparison or parenthesized group.
Add an OR comparison or parenthesized group.
Add an OR comparison or parenthesized group.
Add an OR comparison or parenthesized group.
Fetch a numbered page and a count without mutating the source query.
Read a lossless composite cursor page using native SQL ordering. Cursor sort values remain private text columns, independent of projections and Date decoding. Requires non-null scalar order columns containing a declared unique key.
Read a page using a single raw cursor value; choose a unique, non-null sort column.
Read values of one selected property without altering this query.
Apply a named schema projection with the same exact row-schema guarantees.
ProtectedreadQuote a mapped column for trusted raw SQL or correlated subqueries.
Internal
Prevent customizers from substituting an unrelated query source.
Select an exact flat row shape, retaining per-field runtime schemas.
Select named output fields and aggregates, replacing the previous scalar projection.
Replace the projection with trusted raw SQL and an explicit output schema.
Internal
Native storage columns for composing CTI table sources.
Select a typed SUM result on a new query.
Sum non-null values in an unpaginated clone, preserving numeric precision.
Numeric schema property to sum.
Optionaloptions: AggregateOptions<O>
Optional parser receiving the raw driver value, including null.
Database numeric text, or null for empty/all-null input by default. An output parser replaces default decoding and controls the result type.
Return an independent mutable Knex snapshot, never the query's owned state.
Render debugging SQL without execution; bound values may be sensitive.
Add a synchronous group, retaining the group's inferred named parameters.
Match a record of concrete equality values. Use selectors for parameters.
Match a column and infer a named parameter's storage type.
Add a bound comparison using a supported SQL operator.
Match a fixed value tuple or captured SELECT subquery.
JSON-path strings do not provide a schema-derived parameter type.
Optionaloperator: stringOptionalvalue: A & WithoutParameters<NoInfer<A>>Negate equality while preserving ordinary SQL null semantics.
Match SQL null without changing the declared result type.
Trusted SQL with concrete bindings; use a typed predicate for placeholders.
Immutable table query whose row schema follows its decoded selection and relations. Configuration returns independent lazy builders; metadata access never executes SQL. Only unprojected table queries can write. Full ORM rows may participate in tracking.