Documentation ¶
Index ¶
- type Job
- func (job *Job) At(at time.Time) *Job
- func (job *Job) Every(period time.Duration) *Job
- func (job *Job) EveryAt(at time.Time, period time.Duration) *Job
- func (job *Job) Next() time.Time
- func (job *Job) OnPanic(fn func(interface{})) *Job
- func (job *Job) Run(now time.Time)
- func (job *Job) String() string
- func (job *Job) With(t Timing) *Job
- type Once
- type Periodic
- type PeriodicAt
- type Scheduler
- type Timing
- type TimingWrap
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 encapsulates logic for a scheduled job to be run according to a set Timing, executing the job with a set panic handler, and holding onto a next execution time safely in a concurrent environment.
func (*Job) At ¶
At sets this Job to execute at time, by passing (*sched.Once)(&at) to .With(). See .With() for details.
func (*Job) Every ¶
Every sets this Job to execute every period, by passing sched.Period(period) to .With(). See .With() for details.
func (*Job) EveryAt ¶
EveryAt sets this Job to execute every period starting at time, by passing &PeriodicAt{once: Once(at), period: Periodic(period)} to .With(). See .With() for details.
func (*Job) OnPanic ¶ added in v1.1.1
OnPanic specifies how this job handles panics, default is an actual panic.
type PeriodicAt ¶
PeriodicAt implements Timing to provide a recurring Job execution starting at 'Once' time.
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
Scheduler provides a means of running jobs at specific times and regular intervals, all while sharing a single underlying timer.
func (*Scheduler) Done ¶ added in v1.2.1
func (sch *Scheduler) Done() <-chan struct{}
Done returns a channel that's closed when Scheduler.Stop() is called.
func (*Scheduler) Running ¶
Running will return whether Scheduler is running (i.e. NOT stopped / stopping).
func (*Scheduler) Schedule ¶
Schedule will add provided Job to the Scheduler, returning a cancel function.