Documentation ¶
Overview ¶
package schedule provides utilities for parsing and deserializing cron-style expressions.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Schedule ¶
type Schedule struct {
// contains filtered or unexported fields
}
Schedule represents a cron schedule. It's essentially a thin wrapper for robfig/cron/v3 that implements Stringer.
func Weekly ¶
Weekly parses a Schedule from spec scoped to a recurring weekly event. Spec consists of the following space-delimited fields, in the following order: - timezone e.g. CRON_TZ=US/Central (optional) - minutes of hour e.g. 30 (required) - hour of day e.g. 9 (required) - day of month (must be *) - month (must be *) - day of week e.g. 1 (required)
Example Usage:
local_sched, _ := schedule.Weekly("59 23 *") fmt.Println(sched.Next(time.Now().Format(time.RFC3339))) // Output: 2022-04-04T23:59:00Z us_sched, _ := schedule.Weekly("CRON_TZ=US/Central 30 9 1-5") fmt.Println(sched.Next(time.Now()).Format(time.RFC3339)) // Output: 2022-04-04T14:30:00Z
Click to show internal directories.
Click to hide internal directories.