flyt

12 — Aggregates

Sums and counts, kept as rows are written.

org/queries.flyt
// How many work in a department, kept as employees are written.
aggregate headcount(department: DepartmentId) -> Summary<Headcount> {
  from { e: entities.employee }
  where(e.department == department)
  select(Headcount { people: rows.count() })
}