Documentation
¶
Overview ¶
Package schedparse compiles finite scheduling phrases and validates client-side cron previews. Compile retains the legacy phrase-only interface; Validate is the timezone-aware validation boundary for preview and submission.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Preview ¶ added in v0.0.52
type Preview struct {
Result
Timezone string
Next time.Time // strictly after now, in the chosen timezone
}
Preview is a validated trigger and local estimate, not a server acceptance promise. Re-run Validate at Create with a fresh now, especially for relative phrases.
type Result ¶
type Result struct {
Cron string // a 5-field cron expression, set when the phrase is recurring
OneShot time.Time // a wall-clock instant, set when the phrase is a one-shot (zero otherwise)
}
Result is the outcome of Compile: exactly one of Cron or OneShot is set. The caller decides which kind of trigger to build (a cron schedule vs a one-shot schedule) — Compile only produces the value.
func Compile ¶
Compile parses a natural-language scheduling phrase into a trigger result. If the phrase matches a known pattern, exactly one of Cron or OneShot is set and ok is true. If no pattern matches, ok is false and the caller should treat the input verbatim as a raw cron expression.
now is the reference instant for the one-shot patterns ("next monday 9am", "in 30 minutes", "tomorrow at 9am"); it is ignored by the recurring (cron) patterns.
type ValidationError ¶ added in v0.0.52
ValidationError identifies the form field that needs correction.
func (*ValidationError) Error ¶ added in v0.0.52
func (e *ValidationError) Error() string