GroupedAggregationStage interface
The grouped-aggregation stage returned by GraphQLQueryBuilder.groupBy.
This stage exists to thread the concrete tuple of grouped keys (TGroup)
through the fluent chain. groupBy captures the exact literal keys, and this
interface carries them into GroupedAggregationStage.aggregate's result
type so each grouped row's fields is typed to only the grouped columns
(Pick<Entity, TGroup[number]>) instead of every scalar field.
Only where and aggregate are exposed: the row-shaping methods
(select/orderBy/first/after) are intentionally absent because Data API
Builder rejects a query that combines groupBy with row selection. Those
combinations are therefore compile-time errors on this stage rather than
runtime throws.
Methods
| aggregate<TSpec>(TSpec) | Execute a grouped aggregation over the previously chosen group keys. |
| where(Filter |
Add filter conditions to the grouped aggregation. Repeated calls merge. |
Method Details
aggregate<TSpec>(TSpec)
Execute a grouped aggregation over the previously chosen group keys.
function aggregate<TSpec>(spec: TSpec): GraphQLAggregationBuilder<TSchema, TEntity, TGroup, TSpec>
Parameters
- spec
-
TSpec
The alias-keyed aggregation specification.
Returns
GraphQLAggregationBuilder<TSchema, TEntity, TGroup, TSpec>
A GraphQLAggregationBuilder whose rows' fields are typed
to exactly the grouped keys TGroup.
where(FilterInput<TSchema[TEntity]>)
Add filter conditions to the grouped aggregation. Repeated calls merge.
function where(conditions: FilterInput<TSchema[TEntity]>): GroupedAggregationStage<TSchema, TEntity, TGroup>
Parameters
- conditions
-
FilterInput<TSchema[TEntity]>
The filter conditions to apply.
Returns
GroupedAggregationStage<TSchema, TEntity, TGroup>
This grouped stage, preserving the grouped keys for chaining.