Documentation
¶
Index ¶
- type Alarm
- type EventFunc
- type Scheduler
- func (sc *Scheduler) AddAlarmAt(t time.Time, f EventFunc, repeat bool)
- func (sc *Scheduler) AddAlarmIn(d time.Duration, f EventFunc)
- func (sc *Scheduler) RemoveAlarm(id int64)
- func (sc *Scheduler) RemoveTicker(d time.Duration)
- func (sc *Scheduler) RepeatHours(n int, f EventFunc)
- func (sc *Scheduler) RepeatMinutes(n int, f EventFunc)
- func (sc *Scheduler) RepeatSeconds(n int, f EventFunc)
- func (sc *Scheduler) Wait()
- type Ticker
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alarm ¶
Alarm runs a single function once.
type EventFunc ¶
type EventFunc func(int64)
EventFunc is the signature of the ticker/alarm callbacks.
type Scheduler ¶
Scheduler holds pointers to all the tickers and timers.
func NewScheduler ¶
func NewScheduler() *Scheduler
NewScheduler returns a Scheduler populated with maps.
func (*Scheduler) AddAlarmAt ¶
AddAlarmAt triggers functions at a specific time of day.
func (*Scheduler) AddAlarmIn ¶
AddAlarmIn triggers functions after a specific duration has passed.
func (*Scheduler) RemoveAlarm ¶
RemoveAlarm removes an alarm by id, stopping it if necessary.
func (*Scheduler) RemoveTicker ¶
RemoveTicker removes a ticker by duration, stopping it if necessary.
func (*Scheduler) RepeatHours ¶
RepeatHours adds a repeating task on an hour-based interval.
func (*Scheduler) RepeatMinutes ¶
RepeatMinutes adds a repeating task on a minute-based interval.
func (*Scheduler) RepeatSeconds ¶
RepeatSeconds adds a repeating task based on a seconds interval.
type Ticker ¶
Ticker runs one or more functions, repeating at an interval.