Documentation
¶
Index ¶
Constants ¶
View Source
const ( Duration = "duration" RandomDuration = "random-duration" Daily = "daily" Weekly = "weekly" Monthly = "monthly" Monday = "monday" Tuesday = "tuesday" Wednesday = "wednesday" Thursday = "thursday" Friday = "friday" Saturday = "saturday" Sunday = "sunday" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct{}
Config is currently empty; it exists so that callers wire scheduler the same way as the other Init-style packages and so future configuration can be added without breaking the API.
type Interface ¶
type Interface interface {
Start(ctx context.Context)
Shutdown(ctx context.Context)
Register(ctx context.Context, opt JobOption, handlerFunc any) error
}
Interface is the public surface of the scheduler. Start kicks off the underlying gocron engine, Shutdown drains it, and Register adds a new job described by opt that runs handlerFunc on schedule.
type JobOption ¶
type JobOption struct {
JobType string
Duration time.Duration
Jitter time.Duration
RunningDate int
RunningDay time.Weekday
RunningTime time.Time
}
JobOption describes a single registered job. JobType selects the scheduling strategy (see the package-level Duration, Daily, Weekly, Monthly, RandomDuration constants); the other fields apply conditionally based on the JobType chosen.
Click to show internal directories.
Click to hide internal directories.