Readonly Internal[Type-only fluent return constructor.
Readonly Internal[Type-only ordered argument contract.
Readonly Internal[Nominal identity for typed child-query customizers.
ReadonlyrowRuntime union matching decoded results, including selected variant bodies.
ReadonlyvariantStable object schemas keyed by discriminator, suitable for mapper.configure().
Internal
Shared parameter plan across union branches and included relations.
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.
Explicit AND spelling of where(), including groups and typed parameters.
Configure a captured union SELECT and declare its complete raw output shape.
Internal
Compile one UNION ALL statement; JSON preserves distinct branch shapes.
Optionalcorrelate: ReadCorrelationOptionalmode: typeof COMPILE_PARAMETERSCount matching rows across variants, excluding global pagination and ordering.
Internal
Decode using exactly the selected branch's schema and codecs.
Optionalpath: stringExecute and decode one statement containing every requested branch.
Look up a single entity by primary key. Returns undefined when no
row matches.
The PK column(s) are resolved automatically from the entity's schema
via the primaryKey / hasPrimaryKey extensions. Composite PKs are
passed as a tuple in declaration order:
await db.todos.find(42); // single PK
await db.userRoles.find([userId, role]); // composite PK
Any chained .include() / .includeVariant() calls on this query
are honoured by the underlying SELECT.
Look up multiple entities by primary key in a single SQL statement.
Returns rows in DB order (no ordering guarantee relative to pks).
For composite PKs each element of pks is a tuple matching
declaration order. Returns [] when pks is empty.
Like find but throws EntityNotFoundError when no row matches.
Return the first globally ordered row, or undefined.
Customize a variant's typed read query, including nested relations. Return the configured query; other branches and their schemas are unchanged.
Load a common relation on every branch, configuring the child exactly once.
Optionalcustomize: (Customize a relation on one discriminator branch.
Optionalcustomize: (Internal
Capture native primary keys for a single writable ORM variant.
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.
Globally paginate the discriminated union, leaving the source and its metadata unchanged.
Read a property common to the selected variants; returned scalar values are detached.
Quote a mapped column for trusted raw SQL or correlated subqueries.
Internal
Check the identity of the original read source, retained by clones.
Select trusted SQL from the union envelope with an explicit output contract.
Restrict returned discriminator branches and narrow both runtime and inferred schemas.
Awaiting deliberately executes the query each time.
Optionalresolve: Optionalreject: ((error: any) => E | PromiseLike<E>) | nullReturn a separately mutable Knex snapshot of the union statement.
Render debugging SQL without performing any database calls.
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.
Trusted SQL with concrete bindings; use a typed predicate for placeholders.
Filter one branch using schema property names; other variants remain unaffected.
A tracked-capable polymorphic read; projections use forVariant().