Documentation
¶
Index ¶
- type Scheduler
- type Task
- type TaskConfig
- func (tc *TaskConfig) After(interval time.Duration) *TaskConfig
- func (tc *TaskConfig) At(hour, minute int) *TaskConfig
- func (tc *TaskConfig) Day() *TaskConfig
- func (tc *TaskConfig) Days() *TaskConfig
- func (tc *TaskConfig) Do(f TaskFunc, payloads ...interface{}) (s *Scheduler)
- func (tc *TaskConfig) Friday() *TaskConfig
- func (tc *TaskConfig) From(from time.Time) *TaskConfig
- func (tc *TaskConfig) Hour() *TaskConfig
- func (tc *TaskConfig) Hours() *TaskConfig
- func (tc *TaskConfig) Minute() *TaskConfig
- func (tc *TaskConfig) Minutes() *TaskConfig
- func (tc *TaskConfig) Monday() *TaskConfig
- func (tc *TaskConfig) Saturday() *TaskConfig
- func (tc *TaskConfig) Second() *TaskConfig
- func (tc *TaskConfig) Seconds() *TaskConfig
- func (tc *TaskConfig) Sunday() *TaskConfig
- func (tc *TaskConfig) Thursday() *TaskConfig
- func (tc *TaskConfig) To(to time.Time) *TaskConfig
- func (tc *TaskConfig) Tuesday() *TaskConfig
- func (tc *TaskConfig) Wednesday() *TaskConfig
- func (tc *TaskConfig) Week() *TaskConfig
- func (tc *TaskConfig) Weeks() *TaskConfig
- type TaskFunc
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Scheduler ¶
type Scheduler struct {
// contains filtered or unexported fields
}
func (*Scheduler) Every ¶
func (s *Scheduler) Every(interval ...int) *TaskConfig
Every begins configuring a task. Supply zero or one intervals. No intervals will be counted as 1
func (*Scheduler) Once ¶
func (s *Scheduler) Once() *TaskConfig
Once sets the task to run only once.
type Task ¶
type Task struct {
Payloads []interface{}
Elapsed time.Duration
// contains filtered or unexported fields
}
Task is passed to task handlers and contains the payload
type TaskConfig ¶
type TaskConfig struct {
// contains filtered or unexported fields
}
func (*TaskConfig) After ¶
func (tc *TaskConfig) After(interval time.Duration) *TaskConfig
After starts the task after the specified duration. Short hand for From(time.Now().Add(interval))
func (*TaskConfig) At ¶
func (tc *TaskConfig) At(hour, minute int) *TaskConfig
At sets the time of day to run the task.
func (*TaskConfig) Do ¶
func (tc *TaskConfig) Do(f TaskFunc, payloads ...interface{}) (s *Scheduler)
Do start the task with the supplied payload in a new goroutine.
func (*TaskConfig) Friday ¶
func (tc *TaskConfig) Friday() *TaskConfig
Friday sets the unit to weeks and only runs on Fridays.
func (*TaskConfig) From ¶
func (tc *TaskConfig) From(from time.Time) *TaskConfig
From sets the start time of the task.
func (*TaskConfig) Minute ¶
func (tc *TaskConfig) Minute() *TaskConfig
Minute sets the interval to minutes.
func (*TaskConfig) Monday ¶
func (tc *TaskConfig) Monday() *TaskConfig
Monday sets the unit to weeks and only runs on Mondays.
func (*TaskConfig) Saturday ¶
func (tc *TaskConfig) Saturday() *TaskConfig
Saturday sets the unit to weeks and only runs on Saturdays.
func (*TaskConfig) Second ¶
func (tc *TaskConfig) Second() *TaskConfig
Second sets the interval to seconds.
func (*TaskConfig) Sunday ¶
func (tc *TaskConfig) Sunday() *TaskConfig
Sunday sets the unit to weeks and only runs on Sundays.
func (*TaskConfig) Thursday ¶
func (tc *TaskConfig) Thursday() *TaskConfig
Thursday sets the unit to weeks and only runs on Thursdays.
func (*TaskConfig) To ¶
func (tc *TaskConfig) To(to time.Time) *TaskConfig
To sets the end time of the task.
func (*TaskConfig) Tuesday ¶
func (tc *TaskConfig) Tuesday() *TaskConfig
Tuesday sets the unit to weeks and only runs on Tuesdays.
func (*TaskConfig) Wednesday ¶
func (tc *TaskConfig) Wednesday() *TaskConfig
Wednesday sets the unit to weeks and only runs on Wednesdays.
Source Files
¶
- scheduler.go
- task.go