Skip to main content

GroupBy

Helper to build grouping rules for use with resource().aggregate()

Constructors​

Constructor​

new GroupBy(): GroupBy

Returns​

GroupBy

Methods​

DateTrunc()​

static DateTrunc(field, truncation, timezone?, as?): IGroupByDateTrunc

Group by date truncation. Returns ISO date strings (YYYY-MM-DD) for each group.

Parameters​

ParameterTypeDescription
fieldstringColumn name (must be DATETIME/DATE type in the resource)
truncation"day" | "week" | "month" | "year"'day'
timezone?stringIANA timezone name, e.g. 'Europe/Kyiv'. Defaults to 'UTC' when omitted.
as?string-

Returns​

IGroupByDateTrunc


Field()​

static Field(field, as?): IGroupByField

Group by raw field value. The field value is returned as-is in the group key.

Parameters​

ParameterTypeDescription
fieldstringColumn name to group by
as?string-

Returns​

IGroupByField