Documentation ¶
Overview ¶
Package clockwork enables simple and intuitive scheduling in Go.
Examples:
sched.Schedule().Every(10).Seconds().Do(something) sched.Schedule().Every(3).Minutes().Do(something) sched.Schedule().Every(4).Hours().Do(something) sched.Schedule().Every(2).Days().At("12:32").Do(something) sched.Schedule().Every(12).Weeks().Do(something) sched.Schedule().Every(1).Monday().Do(something) sched.Schedule().Every(1).Saturday().At("8:00").Do(something)
Index ¶
- type Job
- func (j *Job) At(t string) *Job
- func (j *Job) Day() *Job
- func (j *Job) Days() *Job
- func (j *Job) Do(function func()) string
- func (j *Job) Every(frequencies ...int) *Job
- func (j *Job) EverySingle() *Job
- func (j *Job) Friday() *Job
- func (j *Job) Hour() *Job
- func (j *Job) Hours() *Job
- func (j *Job) Minute() *Job
- func (j *Job) Minutes() *Job
- func (j *Job) Monday() *Job
- func (j *Job) Saturday() *Job
- func (j *Job) Second() *Job
- func (j *Job) Seconds() *Job
- func (j *Job) Sunday() *Job
- func (j *Job) Thursday() *Job
- func (j *Job) Tuesday() *Job
- func (j *Job) Wednesday() *Job
- func (j *Job) Week() *Job
- func (j *Job) Weeks() *Job
- type Scheduler
- type TimeUnit
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Job ¶
type Job struct {
// contains filtered or unexported fields
}
Job struct handles all the data required to schedule and run jobs.
func (*Job) At ¶
At method fills the given Job struct atHour and atMinute fields with the provided information
func (*Job) Do ¶
Do method fills the given job struct with the function pointer to the job (user provided task) itself.
func (*Job) EverySingle ¶
EverySingle is deprecated predecessor to Every()
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler type is used to store a group of jobs (Job structs)
func (*Scheduler) Run ¶
func (s *Scheduler) Run()
Run method on the Scheduler type runs the scheduler. This is a blocking method, and should be run as a goroutine.
func (*Scheduler) Schedule ¶
Schedule method on the Scheduler creates a new Job and prepares is for "filling"
func (*Scheduler) SetPollingInterval ¶
SetPollingInterval sets the time (in milliseconds) which scheduler will spend in sleep during each cycle in the Run method