Given following entity class and a postgres database with a related table:
case class Statistics(name: String,
measure: Long,
datetime: Timestamp = new Timestamp(System.currentTimeMillis))
How can I construct a Squeryl aggregate query that returns the count of measures or their accumulated values per day or week, basically resulting in SQL statements similar to:
select count(*), date_trunc('day',datetime) from stats
group by date_trunc('day',datetime);
select sum(*), date_trunc('day',datetime) from stats
group by date_trunc('day',datetime);
using postgres' date_trunc function that is not directly accessible from Squeryl.