Skip to main content

Module query

Module query 

Source
Expand description

Dashboard aggregates over cms_analytics_event.

Built on the ORM’s aggregate API (rustango::core::aggregates

  • QuerySet::{aggregate,values,annotate}): typed columns, conditional .filter() aggregates, and count_distinct. Results come back as Vec<HashMap<String, SqlValue>> (the shape is dynamic), decoded by alias.

Date filtering is typed (created_at.gte(from)) — which works across dialects because created_at is stored as an RFC3339 timestamp (set at insert, not via SQLite’s space-formatted CURRENT_TIMESTAMP). The only raw query is the per-day time series, whose GROUP BY <day-bucket> expression isn’t expressible through the column-based .values() builder.

Structs§

Bucket
A (label, count) group row (top pages, referrers, countries, devices).
DayPoint
One point in the per-day time series.
Metrics
Everything the dashboard renders for a date range (except active_now, which the handler fills from the in-memory presence gauge).

Functions§

compute
Compute all dashboard metrics for [from, to).