Class: SelectBuilder<TSources, TProjection>
Class: SelectBuilder<TSources, TProjection>
Section titled “Class: SelectBuilder<TSources, TProjection>”Defined in: core/src/query/builder.ts:146
Chainable select builder. TSources accumulates per join so the returned
row type is precise; TProjection is fixed at select() time and threads
through unchanged. await works directly via PromiseLike.
Type Parameters
Section titled “Type Parameters”TSources
Section titled “TSources”TSources
TProjection
Section titled “TProjection”TProjection
Implements
Section titled “Implements”PromiseLike<SelectRow<TSources,TProjection>[]>
Constructors
Section titled “Constructors”Constructor
Section titled “Constructor”new SelectBuilder<
TSources,TProjection>(engine,ast):SelectBuilder<TSources,TProjection>
Defined in: core/src/query/builder.ts:149
Parameters
Section titled “Parameters”engine
Section titled “engine”Returns
Section titled “Returns”SelectBuilder<TSources, TProjection>
Accessors
Section titled “Accessors”Get Signature
Section titled “Get Signature”get $ast():
SelectQuery
Defined in: core/src/query/builder.ts:159
The underlying AST. Exposed so builders can be composed as subqueries
via SelectStart.fromSubquery(...) — not part of the fluent API and
generally not something callers touch.
Returns
Section titled “Returns”Methods
Section titled “Methods”innerJoin()
Section titled “innerJoin()”innerJoin<
U>(u,on):SelectBuilder<{ [K in string | number | symbol]: (TSources & { [K in string]: InferRow<U> })[K] },TProjection>
Defined in: core/src/query/builder.ts:163
Type Parameters
Section titled “Type Parameters”U extends AnyTable
Parameters
Section titled “Parameters”U
Returns
Section titled “Returns”SelectBuilder<{ [K in string | number | symbol]: (TSources & { [K in string]: InferRow<U> })[K] }, TProjection>
leftJoin()
Section titled “leftJoin()”leftJoin<
U>(u,on):SelectBuilder<{ [K in string | number | symbol]: (TSources & { [K in string]: InferRow<U> | null })[K] },TProjection>
Defined in: core/src/query/builder.ts:170
Type Parameters
Section titled “Type Parameters”U extends AnyTable
Parameters
Section titled “Parameters”U
Returns
Section titled “Returns”SelectBuilder<{ [K in string | number | symbol]: (TSources & { [K in string]: InferRow<U> | null })[K] }, TProjection>
where()
Section titled “where()”where(
expr):SelectBuilder<TSources,TProjection>
Defined in: core/src/query/builder.ts:186
Parameters
Section titled “Parameters”Returns
Section titled “Returns”SelectBuilder<TSources, TProjection>
orderBy()
Section titled “orderBy()”orderBy(…
orderings):SelectBuilder<TSources,TProjection>
Defined in: core/src/query/builder.ts:191
Parameters
Section titled “Parameters”orderings
Section titled “orderings”…Ordering[]
Returns
Section titled “Returns”SelectBuilder<TSources, TProjection>
groupBy()
Section titled “groupBy()”groupBy(…
columns):SelectBuilder<TSources,TProjection>
Defined in: core/src/query/builder.ts:203
Group rows by the given columns. Aggregate projections then fold once
per distinct key tuple, and non-aggregated projection columns must
appear in groupBy to be well-defined.
Parameters
Section titled “Parameters”columns
Section titled “columns”…AnyColumn[]
Returns
Section titled “Returns”SelectBuilder<TSources, TProjection>
having()
Section titled “having()”having(
expr):SelectBuilder<TSources,TProjection>
Defined in: core/src/query/builder.ts:224
Filter groups after aggregation. Runs after groupBy — reference
aggregate expressions here (e.g. having(gt(count(), 2))) rather than
per-row columns.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”SelectBuilder<TSources, TProjection>
limit()
Section titled “limit()”limit(
n):SelectBuilder<TSources,TProjection>
Defined in: core/src/query/builder.ts:229
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”SelectBuilder<TSources, TProjection>
offset()
Section titled “offset()”offset(
n):SelectBuilder<TSources,TProjection>
Defined in: core/src/query/builder.ts:233
Parameters
Section titled “Parameters”number
Returns
Section titled “Returns”SelectBuilder<TSources, TProjection>
execute()
Section titled “execute()”execute():
Promise<SelectRow<TSources,TProjection>[]>
Defined in: core/src/query/builder.ts:237
Returns
Section titled “Returns”Promise<SelectRow<TSources, TProjection>[]>
live()
Section titled “live()”Defined in: core/src/query/builder.ts:241
Returns
Section titled “Returns”LiveQuery<SelectRow<TSources, TProjection>>
toAST()
Section titled “toAST()”toAST():
SelectQuery
Defined in: core/src/query/builder.ts:245
Returns
Section titled “Returns”then()
Section titled “then()”then<
TResult1,TResult2>(onfulfilled?,onrejected?):PromiseLike<TResult1|TResult2>
Defined in: core/src/query/builder.ts:250
Attaches callbacks for the resolution and/or rejection of the Promise.
Type Parameters
Section titled “Type Parameters”TResult1
Section titled “TResult1”TResult1 = SelectRow<TSources, TProjection>[]
TResult2
Section titled “TResult2”TResult2 = never
Parameters
Section titled “Parameters”onfulfilled?
Section titled “onfulfilled?”((value) => TResult1 | PromiseLike<TResult1>) | null
The callback to execute when the Promise is resolved.
onrejected?
Section titled “onrejected?”((reason) => TResult2 | PromiseLike<TResult2>) | null
The callback to execute when the Promise is rejected.
Returns
Section titled “Returns”PromiseLike<TResult1 | TResult2>
A Promise for the completion of which ever callback is executed.
Implementation of
Section titled “Implementation of”PromiseLike.then