rocicorp / rails

Replicache on Rails
Other
34 stars 3 forks source link

support full table aggregations [2] #54

Closed tantaman closed 7 months ago

tantaman commented 7 months ago

API:

q.select(agg.sum('x'), agg.avg('y'), agg.count());

Allows users to aggregate against an entire table without applying a group-by

The main value-add here is to change count to now be selectable with other fields.

E.g.,

before:

q.count(); and q.select(fields...) were exclusive operations.

Now we can:

q.select(fields..., agg.count())

If the user selects a field that was not aggregated it returns a value from an arbitrary row.

This also allows us to drop PrimitiveView and make all queries sink to the same view class.