Documentation ¶
Overview ¶
Package cron provides functionality for parsing and running cron schedules.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cron ¶
type Cron struct { C <-chan time.Time // The channel on which events are delivered // contains filtered or unexported fields }
A Cron holds a channel that delivers events based on the cron schedule.
type Schedule ¶
type Schedule struct {
// contains filtered or unexported fields
}
Schedule represents a cron schedule.
func ParseSchedule ¶
ParseSchedule parses a cron schedule, which is a space-separated list of five fields representing:
- minutes: 0-59
- hours: 0-23
- days of month: 1-31
- months: 1-12 or JAN-DEC
- days of week: 0-6 or SUN-SAT
Each field may be a glob (e.g., "*"), representing the full range of values, or a comma-separated list, containing individual values (e.g., "JAN") or a dash-separated pair representing a range of values (e.g., "MON-FRI").
The following macros are permitted:
- @yearly: "0 0 1 1 *"
- @annually: "0 0 1 1 *"
- @monthly: "0 0 1 * *"
- @weekly: "0 0 * * 0"
- @daily: "0 0 * * *"
- @hourly: "0 * * * *"
A given timestamp is in the schedule if the associated fields of the timestamp matches each field specified in the schedule.