Skip to content

First-class groupBy and aggregate on delegates #65

Description

@teetangh

Motivation

ORM-first direction in the consuming app (Practitionist/familiarise_mobile#106): dashboard stats currently use JsonQueryBuilder .groupByFields([...]) (e.g. consultation counts by status). Delegates expose groupBy/count, but aggregations (_sum, _avg, _min, _max) are only reachable via ComputedField subqueries or raw paths.

Scope

  • delegate.groupBy(by: [...], where: ..., aggregate: {sum: [...], avg: [...], count: true}) returning typed maps
  • delegate.aggregate(...) for table-wide aggregations without grouping
  • SQL compiler already supports FILTER clauses on PostgreSQL — reuse for conditional counts

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions