Documentation ¶
Index ¶
- func Close()
- func Digest()
- func PushTask(task Task)
- func Schedule(_ *session.Session, _ interface{}, task Task)
- type SchedFunc
- type Task
- type Timer
- type TimerCondition
- type TimerFunc
- type TimerManager
- func (tm *TimerManager) Cron()
- func (tm *TimerManager) NewAfterTimer(duration time.Duration, fn TimerFunc) *Timer
- func (tm *TimerManager) NewCondTimer(condition TimerCondition, fn TimerFunc) *Timer
- func (tm *TimerManager) NewCountTimer(interval time.Duration, count int, fn TimerFunc) *Timer
- func (tm *TimerManager) NewTimer(interval time.Duration, fn TimerFunc) *Timer
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Timer ¶
type Timer struct {
// contains filtered or unexported fields
}
Timer represents a cron job
func NewAfterTimer ¶
NewAfterTimer returns a new Timer containing a function that will be called after duration that specified by the duration argument. The duration d must be greater than zero; if not, NewAfterTimer will panic. Stop the timer to release associated resources.
func NewCondTimer ¶
func NewCondTimer(condition TimerCondition, fn TimerFunc) *Timer
NewCondTimer returns a new Timer containing a function that will be called when condition satisfied that specified by the condition argument. The duration d must be greater than zero; if not, NewCondTimer will panic. Stop the timer to release associated resources.
func NewCountTimer ¶
NewCountTimer returns a new Timer containing a function that will be called with a period specified by the duration argument. After count times, timer will be stopped automatically, It adjusts the intervals for slow receivers. The duration d must be greater than zero; if not, NewCountTimer will panic. Stop the timer to release associated resources.
func NewTimer ¶
NewTimer returns a new Timer containing a function that will be called with a period specified by the duration argument. It adjusts the intervals for slow receivers. The duration d must be greater than zero; if not, NewTimer will panic. Stop the timer to release associated resources.
type TimerCondition ¶
TimerCondition represents a checker that returns true when cron job needs to execute
type TimerFunc ¶
type TimerFunc func()
TimerFunc represents a function which will be called periodically in main logic gorontine.
type TimerManager ¶ added in v1.0.1
type TimerManager struct {
// contains filtered or unexported fields
}
func NewTimerManager ¶ added in v1.0.1
func NewTimerManager() *TimerManager
func (*TimerManager) Cron ¶ added in v1.0.1
func (tm *TimerManager) Cron()
func (*TimerManager) NewAfterTimer ¶ added in v1.0.1
func (tm *TimerManager) NewAfterTimer(duration time.Duration, fn TimerFunc) *Timer
NewAfterTimer returns a new Timer containing a function that will be called after duration that specified by the duration argument. The duration d must be greater than zero; if not, NewAfterTimer will panic. Stop the timer to release associated resources.
func (*TimerManager) NewCondTimer ¶ added in v1.0.1
func (tm *TimerManager) NewCondTimer(condition TimerCondition, fn TimerFunc) *Timer
NewCondTimer returns a new Timer containing a function that will be called when condition satisfied that specified by the condition argument. The duration d must be greater than zero; if not, NewCondTimer will panic. Stop the timer to release associated resources.
func (*TimerManager) NewCountTimer ¶ added in v1.0.1
NewCountTimer returns a new Timer containing a function that will be called with a period specified by the duration argument. After count times, timer will be stopped automatically, It adjusts the intervals for slow receivers. The duration d must be greater than zero; if not, NewCountTimer will panic. Stop the timer to release associated resources.
func (*TimerManager) NewTimer ¶ added in v1.0.1
func (tm *TimerManager) NewTimer(interval time.Duration, fn TimerFunc) *Timer
NewTimer returns a new Timer containing a function that will be called with a period specified by the duration argument. It adjusts the intervals for slow receivers. The duration d must be greater than zero; if not, NewTimer will panic. Stop the timer to release associated resources.