Documentation ¶
Overview ¶
Package repeat provides a system to run functions repeated on a schedule.
Index ¶
- type Cron
- type Repeater
- func (r *Repeater) Add(ctx context.Context, id int64, ...) error
- func (r *Repeater) AddCron(ctx context.Context, id int64, ...) error
- func (r *Repeater) Count(ctx context.Context) (repeats, schedules int, err error)
- func (r *Repeater) Remove(ctx context.Context, id int64) error
- func (r *Repeater) RemoveCron(ctx context.Context, id int64) error
- func (r *Repeater) Reset(ctx context.Context) error
- func (r *Repeater) Run(ctx context.Context) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Repeater ¶
type Repeater struct {
// contains filtered or unexported fields
}
Repeater manages repeated functions.
func (*Repeater) Add ¶
func (r *Repeater) Add(ctx context.Context, id int64, fn func(ctx context.Context, id int64) (readd bool), start time.Time, interval time.Duration) error
Add adds a repeated task occurring at an interval, given the specified ID.
func (*Repeater) AddCron ¶
func (r *Repeater) AddCron(ctx context.Context, id int64, fn func(ctx context.Context, id int64) (readd bool), expr *Cron) error
AddCron adds a repeated task which repeats based on a cron expression. Cron tasks may safely share IDs with regular repeated tasks.
func (*Repeater) RemoveCron ¶
RemoveCron removes a repeated cron task.
Click to show internal directories.
Click to hide internal directories.