type Condition func(now time.Time) (deadline time.Time, callback func())
Condition is a function that gets executed periodically, and receives the
current time as an argument.
It should return the deadline for the notification, as well as a
callback function to execute. If deadline is the zero
time, callback will not be executed.
Callback is executed once for every time the difference between deadline
and the current time is less than an element of countdown.
To enforce a minimum interval between consecutive callbacks, truncate
the returned deadline to the minimum interval.
type Notifier struct {
// contains filtered or unexported fields
}
Notifier triggers callbacks at given intervals until some event happens. The
intervals (e.g. 10 minute warning, 5 minute warning) are given in the
countdown. The Notifier periodically polls the condition to get the time of
the event (the Condition's deadline) and the callback. The callback is
called at most once per entry in the countdown, the first time the time to
the deadline is shorter than the duration.