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) AddDesc(d string) *Job
- func (j *Job) At(t string) *Job
- func (j *Job) Day() *Job
- func (j *Job) Days() *Job
- func (j *Job) Desc() string
- 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) ID() string
- func (j *Job) Info() JobInfo
- 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) Stop()
- func (j *Job) Stopped() bool
- 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 JobInfo
- type LogLevel
- type Logger
- 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 atHout 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 Logger ¶
type Logger interface { Output() io.Writer SetOutput(w io.Writer) Prefix() string SetPrefix(p string) Level() LogLevel SetLevel(v LogLevel) Print(i ...interface{}) Printf(format string, args ...interface{}) Debug(i ...interface{}) Debugf(format string, args ...interface{}) Info(i ...interface{}) Infof(format string, args ...interface{}) Warn(i ...interface{}) Warnf(format string, args ...interface{}) Error(i ...interface{}) Errorf(format string, args ...interface{}) Fatal(i ...interface{}) Fatalf(format string, args ...interface{}) Panic(i ...interface{}) Panicf(format string, args ...interface{}) }
Logger defines the logging interface.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler type is used to store a group of jobs (Job structs)
func NewScheduler ¶
NewScheduler creates and returns a new Scheduler
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.