Documentation
¶
Overview ¶
Package r3when is the bridge between the years schedule vocabulary and r3 filters. It compiles recurring weekly wall-clock patterns (schedule.WeekPatterns) into r3.Filters built from the vocabulary-free OperatorWeekdayIn and OperatorTimeOfDayBetween primitives, and resolves human terms ("weekends", "mornings") into those patterns via years.
It is a dialect in the same sense as the URL or JSON dialects: it translates an external, human representation of a filter into the r3 query model. Keeping it here - not in the r3 core - is what lets the core stay free of the years dependency and free of any time vocabulary. r3 knows how to compare time components; only this dialect knows that "weekends" means Saturday and Sunday.
The compiled filters use nothing but root filter vocabulary, so they serialize through every r3 dialect and run on any engine that lowers the two operators (the file engine and Mongo today; SQL once the flavor hook lands - see docs/plan-when-filters.md).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Filters ¶
func Filters(field string, ps schedule.WeekPatterns) r3.Filters
Filters compiles a union of week patterns into r3 filters against field. The union is an OR of per-pattern groups; each pattern is a conjunction of its weekday set and its time-of-day spans. An empty pattern set - or any pattern that matches every instant - compiles to nil (no filter), since an OR with a match-everything member matches everything.
The output uses only root filter vocabulary (WeekdayIn / TimeOfDayBetween and And/Or groups), so it serializes through every dialect and runs on any engine that lowers those operators.
Types ¶
This section is empty.