cron

package
v1.7.10 Latest Latest
Warning

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

Go to latest
Published: Apr 9, 2024 License: MIT Imports: 7 Imported by: 2

Documentation

Overview

Package cron emulate linux crontab

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ParseNextTime

func ParseNextTime(cronLine string) (nextTime time.Time, err error)

Types

type Expression

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

func Parse

func Parse(cronLine string) (*Expression, error)

func (*Expression) Next

func (expr *Expression) Next(fromTime time.Time) time.Time

Next returns the closest time instant immediately following `fromTime` which matches the cron expression `expr`

func (*Expression) NextN

func (expr *Expression) NextN(fromTime time.Time, n uint) []time.Time

NextN returns a slice of `n` closest time instants immediately following `fromTime` which match the cron expression `expr`

type Job

type Job struct {
	NextTime time.Time
	// contains filtered or unexported fields
}

Job cron job

type JobTable added in v0.1.35

type JobTable struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func New

func New() *JobTable

func (*JobTable) Add added in v0.1.35

func (c *JobTable) Add(cronLine string, fn func()) (remove func(), err error)

func (*JobTable) ForceRun added in v0.1.49

func (c *JobTable) ForceRun() (nextTime time.Duration)

func (*JobTable) Run added in v0.1.35

func (c *JobTable) Run(block ...bool)

func (*JobTable) Stop added in v0.1.53

func (c *JobTable) Stop()

Jump to

Keyboard shortcuts

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