Documentation
¶
Overview ¶
Package cronx is graith's single, owned abstraction for cron schedules. It exists so config validation and daemon execution parse cron with exactly one grammar — before this package the two lived in separate robfig parsers (config.cronSpecParser and daemon.cronParser) that could silently drift.
The grammar is deliberately narrow and matches what the docs promise: a five-field expression, or one of four descriptors. See Grammar for the full contract. Anything outside it — six/seven-field forms (seconds/year), the undocumented robfig descriptors (@yearly/@annually/@midnight/@reboot/@every), and Quartz/gronx extensions (?, L, W, #) — is rejected, so what config validation accepts is exactly what the runtime can fire.
The engine underneath is robfig/cron/v3, used only as a parser + Next() (never its scheduler). We evaluated replacing it with github.com/adhocore/gronx (issue #1213) and rejected the swap: gronx v1.20.0 (the latest) computes wrong next-fire times — ones its own IsDue rejects — for day-of-month values absent in the current month (29/30/31), leap-day Feb 29, and DST fall-back transitions. The differential corpus in cronx_diff_test.go pins that evidence and acts as a tripwire if a future gronx fixes it. See docs/design/2026-07-16-cron-parser-evaluation.md.
Index ¶
Constants ¶
const Grammar = `` /* 1054-byte string literal not displayed */
Grammar documents the exact cron grammar graith accepts. It is the single source of truth referenced by the config docs and the trigger docs.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Schedule ¶
type Schedule struct {
// contains filtered or unexported fields
}
Schedule is a parsed graith cron schedule. The zero value is not usable; obtain one from Parse.
func Parse ¶
Parse validates spec against Grammar and returns a Schedule. A returned error is safe to surface to users: it explains what was rejected.