Open parsonsmatt opened 3 years ago
What does this look like? Would this be captured by a phantom type Interval
?
persistent-postgresql
has PgInterval
type, so I think we'd just want some functions for building them from various numeric types. LIke interval_ :: IntervalType -> SqlExpr (Value Int) -> SqlExpr (Value PgInterval)
, so you can write interval_ Days (val 3)
or whatever
How does one handle the "1 day" case if the number is a SqlExpr?
I had a need for this today in:
generate_series(date_trunc('week', current_date - interval '13 weeks'), date_trunc('week', current_date - interval '1 week'), interval '1 week') {{weekly}} ) d
responding to my earlier question we would always use the singular form and then multiply so
interval_ Days (val 3)
would become ("? * interval '1 day'", [PersistInt64 3])
We should support postgres interval notation.