Versions in this module Expand all Collapse all v1 v1.0.1 Mar 8, 2026 Changes in this version + var ErrInvalidTick = errors.New("tick must be greater than or equal to 1ms") + var ErrInvalidWheelSize = errors.New("wheelSize must be greater than 0") + func Add(delay time.Duration, fn func(), async ...bool) uint64 + func AddCronSchedule(expr string, fn func(), async ...bool) uint64 + func AddSchedule(schedule *FixedDateSchedule, fn func(), async ...bool) uint64 + func AddScheduleOnce(schedule *FixedDateSchedule, fn func(), async ...bool) uint64 + func CronExpression(expr string) bool + func MSToTime(t int64) time.Time + func NextId() uint64 + func Once(delay time.Duration, fn func(), async ...bool) uint64 + func Remove(id uint64) + func StartActor(actor TimerActor) + func TimeToMS(t time.Time) int64 + type CronSchedule struct + func MustNewCronSchedule(expr string) *CronSchedule + func NewCronSchedule(expr string) (*CronSchedule, error) + func (s *CronSchedule) Next(prev time.Time) time.Time + type DefaultTimerActor struct + func NewDefaultTimerActor(tick time.Duration, wheelSize int64) *DefaultTimerActor + func (a *DefaultTimerActor) Add(delay time.Duration, fn func(), async ...bool) uint64 + func (a *DefaultTimerActor) AddCronSchedule(expr string, fn func(), async ...bool) uint64 + func (a *DefaultTimerActor) AddSchedule(schedule *FixedDateSchedule, fn func(), async ...bool) uint64 + func (a *DefaultTimerActor) AddScheduleOnce(schedule *FixedDateSchedule, fn func(), async ...bool) uint64 + func (a *DefaultTimerActor) Once(delay time.Duration, fn func(), async ...bool) uint64 + func (a *DefaultTimerActor) Remove(id uint64) + func (a *DefaultTimerActor) Start(tick time.Duration, wheelSize int64) error + func (a *DefaultTimerActor) Stop() + type DelayQueue struct + C chan interface{} + func NewDelayQueue(size int) *DelayQueue + func (dq *DelayQueue) Offer(elem interface{}, expiration int64) + func (dq *DelayQueue) Poll(exitC chan struct{}, nowF func() int64) + type EverySchedule struct + Interval time.Duration + func (s *EverySchedule) Next(prev time.Time) time.Time + type FixedDateSchedule struct + Hour int + Minute int + Second int + func (s *FixedDateSchedule) Next(prev time.Time) time.Time + type Scheduler interface + Next func(time.Time) time.Time + type TimeWheel struct + func NewTimeWheel(tick time.Duration, wheelSize int64) (*TimeWheel, error) + func (tw *TimeWheel) AddEveryFunc(id uint64, d time.Duration, f func(), async ...bool) *Timer + func (tw *TimeWheel) AfterFunc(id uint64, d time.Duration, f func(), async ...bool) *Timer + func (tw *TimeWheel) BuildAfterFunc(d time.Duration, f func()) *Timer + func (tw *TimeWheel) BuildEveryFunc(d time.Duration, f func(), async ...bool) *Timer + func (tw *TimeWheel) NextId() uint64 + func (tw *TimeWheel) Remove(id uint64) *Timer + func (tw *TimeWheel) ScheduleFunc(id uint64, s Scheduler, f func(), async ...bool) *Timer + func (tw *TimeWheel) Start(ctx context.Context) + func (tw *TimeWheel) Stop() + type Timer struct + func (t *Timer) ID() uint64 + func (t *Timer) Stop() bool + type TimerActor interface + Add func(delay time.Duration, fn func(), async ...bool) uint64 + AddCronSchedule func(expr string, fn func(), async ...bool) uint64 + AddSchedule func(schedule *FixedDateSchedule, fn func(), async ...bool) uint64 + AddScheduleOnce func(schedule *FixedDateSchedule, fn func(), async ...bool) uint64 + Once func(delay time.Duration, fn func(), async ...bool) uint64 + Remove func(id uint64) + func GetDefaultActor() TimerActor