Documentation
¶
Index ¶
Constants ¶
const (
UserSchema = "UserScheduler"
)
Variables ¶
This section is empty.
Functions ¶
Types ¶
type LocalScheduler ¶
type LocalScheduler interface {
Schedule(Task)
}
LocalScheduler schedules task to a customized goroutine
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 UserScheduler ¶ added in v0.6.1
type UserScheduler struct {
// contains filtered or unexported fields
}
func NewUserScheduler ¶ added in v0.6.1
func NewUserScheduler(cap int) *UserScheduler
func (*UserScheduler) Close ¶ added in v0.6.1
func (us *UserScheduler) Close()
func (*UserScheduler) Sched ¶ added in v0.6.1
func (us *UserScheduler) Sched()
func (*UserScheduler) Schedule ¶ added in v0.6.1
func (us *UserScheduler) Schedule(task Task)