cron

package module
v0.2.1 Latest Latest
Warning

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

Go to latest
Published: Dec 10, 2022 License: MIT Imports: 4 Imported by: 1

README

cron

Go Report Card GoDoc GitHub license gocover.io

Cron is a lightweight cron job library that uses a single goroutine to manage the scheduling of all jobs, so please do not block the execution process.

Licensed under the MIT License. See LICENSE for the full license text.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Cron

type Cron struct {
	// contains filtered or unexported fields
}

Cron is a cron job manager.

func NewCron

func NewCron() *Cron

NewCron returns a new Cron.

func (*Cron) Add

func (t *Cron) Add(nextFunc NextFunc, doFunc DoFunc) bool

Add adds a job to the cron.

func (*Cron) AddWithCancel

func (t *Cron) AddWithCancel(nextFunc NextFunc, doFunc DoFunc) (cancelFunc DoFunc, ok bool)

AddWithCancel adds a job to the cron and returns a function to cancel the job.

type DoFunc

type DoFunc func()

type NextFunc

type NextFunc func(now time.Time) (time.Time, bool)

func Order

func Order(ts ...time.Time) NextFunc

Order is an order timer.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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