cron

package
v0.373.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Next

func Next(pattern Pattern, allowCurrentTime bool) (time.Time, error)

Next calculates the next time that matches the pattern after the current time See NextAfter for more details

func NextAfter

func NextAfter(pattern Pattern, origin time.Time, inclusive bool) (time.Time, error)

NextAfter calculates the next time that matches the pattern after the origin time If inclusive is true, the origin time is considered a valid match All calculations are done in UTC, and the result is returned in UTC

Types

type Component

type Component struct {
	List []Step `parser:"(@@ (',' @@)*)"`
}

func (Component) String

func (c Component) String() string

type DayOfWeek added in v0.253.0

type DayOfWeek string

type Pattern

type Pattern struct {
	Duration   *string     `parser:"@(Number ('s' | 'm' | 'h'))"`
	DayOfWeek  *DayOfWeek  `parser:"| @('Mon' | 'Tue' | 'Wed' | 'Thu' | 'Fri' | 'Sat' | 'Sun')"`
	Components []Component `parser:"| @@+"`
	// contains filtered or unexported fields
}

func Parse

func Parse(text string) (Pattern, error)

func (Pattern) String

func (p Pattern) String() string

type Step

type Step struct {
	ValueRange ValueRange `parser:"@@"`
	Step       *int       `parser:"('/' @Number)?"`
}

func (*Step) String

func (s *Step) String() string

type ValueRange

type ValueRange struct {
	IsFullRange bool `parser:"(@'*'"`
	Start       *int `parser:"| @Number"`
	End         *int `parser:"('-' @Number)?)"`
}

func (*ValueRange) String

func (r *ValueRange) String() string

Jump to

Keyboard shortcuts

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