Skip to main content

fold_dates

Function fold_dates 

Source
pub fn fold_dates(e: Expr, now_ms: i64) -> Expr
Expand description

Dates over literals fold to literals (spec/surface §1.3 “Dates and durations”, 4.8): date("today"), dur("30 days"), and a date method whose receiver and arguments are literals (date("today").minus(dur("30 days")), folded inside-out since transform maps children first) become the string / number / null they evaluate to — by the SAME functions the context runs, so nothing changes in meaning — before the planner sees the tree. So where updated_at < date("today") is a text-vs-text comparison the translator pushes down (a call is otherwise an unconditional decline), and a named point is resolved ONCE per query, at now_ms. A call with the wrong arity is left in place: it raises when evaluated, and an empty source never evaluates it (spec/oqx §11).