tasks

package
v0.128.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 2, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Func

type Func struct {
	// The shortest interval between each run.
	IntervalLow time.Duration

	// The longest interval between each run.
	IntervalHigh time.Duration

	// The function to run.
	F func(interval time.Duration) (time.Duration, error)
	// contains filtered or unexported fields
}

type RunEvery

type RunEvery struct {
	// Any error returned from the function will be passed to this function.
	HandleError func(string, error)

	// If set, the function will be run immediately.
	RunImmediately bool
	// contains filtered or unexported fields
}

RunEvery runs a function at intervals defined by the function itself. Functions can be added and removed while running.

func (*RunEvery) Add

func (r *RunEvery) Add(name string, f Func)

Add adds a function to the RunEvery.

func (*RunEvery) Close

func (r *RunEvery) Close() error

Close stops the RunEvery from running.

func (*RunEvery) Has

func (r *RunEvery) Has(name string) bool

Has returns whether the RunEvery has a function with the given name.

func (*RunEvery) Remove

func (r *RunEvery) Remove(name string)

Remove removes a function from the RunEvery.

func (*RunEvery) Start

func (r *RunEvery) Start() error

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL