cron

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 15, 2024 License: Apache-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ZeroTime    = time.Unix(0, 0)
	DefaultTime = time.Time{}
)

Functions

func Cancel

func Cancel()

func Run

func Run()

Types

type Interface

type Interface interface {
	Add(cronExpr string, task Task) (TaskStopper, error)
	AddFunc(cronExpr, name string, f func() bool) (TaskStopper, error)
	Cancel()
	GetTasks() map[Task]Status
	GetRunning() map[Task]Status
}

type Status

type Status interface {
	LastTime() time.Time
	NextTime() time.Time
	Count() uint64
	InRunning() bool
}

type Task

type Task interface {
	Name() string
	Do() (stop bool)
	NextTime(from time.Time) time.Time
}

type TaskStopper

type TaskStopper interface {
	Task

	Stop()
}

func Add

func Add(cron, name string, f func() bool) (TaskStopper, error)

func AddTask

func AddTask(task Task) (TaskStopper, error)

Jump to

Keyboard shortcuts

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