Versions in this module Expand all Collapse all v1 v1.0.0 Aug 26, 2026 Changes in this version + const DefaultCallbackTimeout + const DefaultLeaseOperationTimeout + const DefaultMaxConcurrentCallbacks + const DefaultMaxConcurrentExecutions + const DefaultOneServerTTL + const DefaultOverlapTTL + const MaxCatchUp + const MaxConditions + const MaxEnvironments + const MaxExpressionBytes + const MaxIdentityBytes + const MaxJitter + const MaxMetadataBytes + const MaxMetadataEntries + const MaxObservers + const MaxOccurrenceScan + const MaxParameterBytes + const MaxSchedules + const MaxTimeWindows + var ErrCallbackCapacity = errors.New("scheduler: callback capacity exhausted") + var ErrCallbackTimeout = errors.New("scheduler: callback timed out") + var ErrDraining = errors.New("scheduler: runner is draining") + var ErrDuplicateSchedule = errors.New("scheduler: duplicate schedule") + var ErrExecutionCapacity = errors.New("scheduler: execution capacity exhausted") + var ErrInvalidConstraint = errors.New("scheduler: invalid schedule constraint") + var ErrInvalidDateBounds = errors.New("scheduler: invalid date bounds") + var ErrInvalidDuration = errors.New("scheduler: duration must be positive") + var ErrInvalidExpression = errors.New("scheduler: invalid cron expression") + var ErrInvalidMissedRuns = errors.New("scheduler: invalid missed-run policy") + var ErrInvalidRunner = errors.New("scheduler: invalid runner dependencies") + var ErrInvalidTimezone = errors.New("scheduler: invalid timezone") + var ErrInvalidVersion = errors.New("scheduler: version is required") + var ErrOccurrenceLimit = errors.New("scheduler: occurrence scan limit exceeded") + var ErrPaused = errors.New("scheduler: paused") + var ErrResourceLimit = errors.New("scheduler: resource limit exceeded") + var ErrScheduleNameRequired = errors.New("scheduler: schedule name is required") + var ErrScheduleNotFound = errors.New("scheduler: schedule not found") + var ErrTaskNameRequired = errors.New("scheduler: task name is required") + var ErrTaskPanic = errors.New("scheduler: task panicked") + var ErrUnsupportedHeartbeat = errors.New("scheduler: lease heartbeat is unsupported") + var ErrUnsupportedOverlap = errors.New("scheduler: overlap replacement is unsupported") + type Clock interface + After func(time.Duration) <-chan time.Time + Now func() time.Time + type Condition func(Context) (bool, error) + type Context struct + Attempt int + Due time.Time + Fencing uint64 + IdempotencyKey string + Metadata map[string]string + Now time.Time + Owner string + Schedule Schedule + type Event struct + At time.Time + Background bool + Context context.Context + Err error + Fencing uint64 + Occurrence Occurrence + Owner string + Result Result + Type EventType + type EventType uint8 + const EventBefore + const EventCompleted + const EventFailure + const EventFinished + const EventOverlap + const EventSkipped + const EventSuccess + func (eventType EventType) String() string + type Executor interface + Execute func(context.Context, Context) error + type Hook func(Event) + type Hooks struct + After Hook + Before Hook + Completed Hook + Failure Hook + Overlap Hook + Skipped Hook + Success Hook + type Interval struct + func At(at string) Interval + func Cron(expression string) Interval + func Daily() Interval + func DailyAt(at string) Interval + func DaysOfMonth(days ...int) Interval + func EveryFifteenMinutes() Interval + func EveryFifteenSeconds() Interval + func EveryFiveMinutes() Interval + func EveryFiveSeconds() Interval + func EveryFourHours(minutes ...int) Interval + func EveryFourMinutes() Interval + func EveryMinute() Interval + func EveryOddHour(minutes ...int) Interval + func EverySecond() Interval + func EverySixHours(minutes ...int) Interval + func EveryTenMinutes() Interval + func EveryTenSeconds() Interval + func EveryThirtyMinutes() Interval + func EveryThirtySeconds() Interval + func EveryThreeHours(minutes ...int) Interval + func EveryThreeMinutes() Interval + func EveryTwentySeconds() Interval + func EveryTwoHours(minutes ...int) Interval + func EveryTwoMinutes() Interval + func EveryTwoSeconds() Interval + func Hourly() Interval + func HourlyAt(minute int) Interval + func LastDayOfMonth(at string) Interval + func Monthly() Interval + func MonthlyOn(day int, at string) Interval + func Quarterly() Interval + func QuarterlyOn(day int, at string) Interval + func TwiceDaily(firstHour, secondHour int) Interval + func TwiceDailyAt(firstHour, secondHour, minute int) Interval + func TwiceMonthly(firstDay, secondDay int, at string) Interval + func Weekly() Interval + func WeeklyOn(day time.Weekday, at string) Interval + func Yearly() Interval + func YearlyOn(month time.Month, day int, at string) Interval + func (i Interval) Expression() string + type MaintenancePolicy uint8 + const MaintenanceRun + const MaintenanceSkip + type MissedRunPolicy uint8 + const MissedRunCatchUp + const MissedRunOnce + const MissedRunSkip + type Observer interface + Observe func(Event) + type ObserverFunc func(Event) + func (observe ObserverFunc) Observe(event Event) + type Occurrence struct + Attempt int + IdempotencyKey string + ScheduleID string + ScheduleName string + ScheduledAt time.Time + Task string + type Option func(*Schedule) error + func EvenWhenPaused() Option + func OnOneServer() Option + func RunInBackground() Option + func WithBetween(start, end string) Option + func WithCondition(condition Condition) Option + func WithDateBounds(start, end time.Time) Option + func WithDays(days ...time.Weekday) Option + func WithEnabled(enabled bool) Option + func WithEnvironments(environments ...string) Option + func WithFridays() Option + func WithHooks(hooks Hooks) Option + func WithJitter(jitter time.Duration) Option + func WithMaintenancePolicy(policy MaintenancePolicy) Option + func WithMetadata(metadata map[string]string) Option + func WithMissedRuns(policy MissedRunPolicy, maxCatchUp int) Option + func WithMondays() Option + func WithOneServer(ttl time.Duration) Option + func WithOverlap(policy OverlapPolicy) Option + func WithParameters(parameters map[string]any) Option + func WithRunTimeout(timeout time.Duration) Option + func WithSaturdays() Option + func WithSkip(skip Condition) Option + func WithSundays() Option + func WithThursdays() Option + func WithTimezone(timezone string) Option + func WithTuesdays() Option + func WithUnlessBetween(start, end string) Option + func WithVersion(version string) Option + func WithWednesdays() Option + func WithWeekdays() Option + func WithWeekends() Option + func WithoutOverlap(policy OverlapPolicy, ttl time.Duration) Option + func WithoutOverlapping(minutes ...int) Option + type OverlapPolicy uint8 + const OverlapAllow + const OverlapReplace + const OverlapSkip + type PauseController interface + Pause func(context.Context) error + Resume func(context.Context) error + type PauseSource interface + Paused func(context.Context) (bool, error) + type PauseState struct + func NewPauseState() *PauseState + func (state *PauseState) Pause(ctx context.Context) error + func (state *PauseState) Paused(ctx context.Context) (bool, error) + func (state *PauseState) Resume(ctx context.Context) error + type Registry struct + func Compile(schedules ...Schedule) (*Registry, error) + func (registry *Registry) ClearCache(ctx context.Context, store lease.Store) (int, error) + func (registry *Registry) Due(name string, after, through time.Time) ([]Occurrence, error) + func (registry *Registry) Next(name string, after time.Time) (time.Time, error) + func (registry *Registry) Overview(after time.Time) []ScheduleOverview + func (registry *Registry) Schedules() []Schedule + type Result uint8 + const ResultFailed + const ResultSkipped + const ResultSucceeded + func (result Result) String() string + type Runner struct + func NewRunner(registry *Registry, leases lease.Store, executor Executor, ...) (*Runner, error) + func (runner *Runner) Drain(ctx context.Context) error + func (runner *Runner) Run(ctx context.Context) error + func (runner *Runner) RunFrom(ctx context.Context, cursor time.Time) error + func (runner *Runner) Tick(ctx context.Context, after, through time.Time) error + type RunnerOption func(*Runner) error + func WithCallbackTimeout(timeout time.Duration) RunnerOption + func WithClock(clock Clock) RunnerOption + func WithEnvironment(environment string) RunnerOption + func WithHeartbeatInterval(interval time.Duration) RunnerOption + func WithLeaseOperationTimeout(timeout time.Duration) RunnerOption + func WithMaintenanceMode(enabled bool) RunnerOption + func WithMaxConcurrentCallbacks(limit int) RunnerOption + func WithMaxConcurrentExecutions(limit int) RunnerOption + func WithObserver(observer Observer) RunnerOption + func WithOwner(owner string) RunnerOption + func WithPauseSource(source PauseSource) RunnerOption + type Schedule struct + Conditions []Condition + CoordinationID string + DaysOfWeek []time.Weekday + Enabled bool + EndAt time.Time + Environments []string + EvenWhenPaused bool + Expression string + Hooks Hooks + Identity string + Jitter time.Duration + LeaseTTL time.Duration + MaintenancePolicy MaintenancePolicy + MaxCatchUp int + Metadata map[string]string + MissedRunPolicy MissedRunPolicy + Name string + OnOneServer bool + OneServerTTL time.Duration + OverlapPolicy OverlapPolicy + OverlapTTL time.Duration + ParameterIdentity string + Parameters map[string]any + RunInBackground bool + RunTimeout time.Duration + StartAt time.Time + Task string + TimeWindows []TimeWindow + Timezone string + Version string + WithoutOverlapping bool + func NewSchedule(name, task string, interval Interval, options ...Option) (Schedule, error) + type ScheduleOverview struct + Next time.Time + Schedule Schedule + type TimeWindow struct + End time.Duration + Excluded bool + Start time.Duration