task

package
v0.17.3 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2022 License: BSD-3-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package task implements jobs which can run at given intervals

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Job

type Job struct {
	time.Duration
}

Job runs a given function using its duration as the interval

func NewJob

func NewJob(m int) *Job

NewJob creates a new job using the given amount of Minutes as the interval.

func (*Job) MarshalYAML

func (j *Job) MarshalYAML() (interface{}, error)

func (*Job) Run

func (j *Job) Run(f func() error, taskName string, runOnStart bool, log zerolog.Logger)

Run executes a f at intervals specified by Job's duration. runOnStart can be specified to have f run when Run is called instead of only when the first tick from the ticker.

func (*Job) UnmarshalYAML

func (j *Job) UnmarshalYAML(unmarshal func(interface{}) error) error

Jump to

Keyboard shortcuts

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