Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AtSchedule ¶
AtSchedule extends Schedule by enabling periodic-interval & time-specific setup
func Every ¶
func Every(p time.Duration) AtSchedule
Every returns a Schedule reoccurs every period p, p must be at least time.Second.
type Cron ¶
type Cron struct {
// contains filtered or unexported fields
}
Cron provides a convenient interface for scheduling job such as to clean-up database entry every month.
Cron keeps track of any number of entries, invoking the associated func as specified by the schedule. It may also be started, stopped and the entries may be inspected.
func (*Cron) Add ¶
Add appends schedule, job to entries.
if cron instant is not running, adding to entries is trivial. otherwise, to prevent data-race, adds through channel.
type Entry ¶
type Entry struct { Schedule Schedule Job Job // the next time the job will run. This is zero time if Cron has not been // started or invalid schedule. Next time.Time // the last time the job was run. This is zero time if the job has not been // run. Prev time.Time }
Entry consists of a schedule and the job to be executed on that schedule.
type Job ¶
type Job interface {
Run()
}
Job is the interface that wraps the basic Run method.
Run executes the underlying func.