cron

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Feb 13, 2025 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Expression

type Expression interface {
	// Next returns the closest time instant immediately following `fromTime` which
	// matches the cron expression `expr`.
	Next(fromTime time.Time) time.Time
}

Expression is implemented by cron expressions.

func NewExpressionFromCronSchedule

func NewExpressionFromCronSchedule(spec *execution.CronSchedule, parser *Parser, hashID string) (Expression, error)

NewExpressionFromCronSchedule returns a new Expression after parsing all expressions from *execution.CronSchedule.

func NewMultiExpression

func NewMultiExpression(expressions ...Expression) Expression

NewMultiExpression wraps multiple Expression into a single one.

type Parser

type Parser struct {
	// Specifies the CronFormat to use.
	Format cronexpr.CronFormat

	// If true, names will be hashed when passed to Parse.
	HashNames bool

	// Optionally specify the raw ParseOption to pass to the cronexpr parser
	ParseOptions []cronexpr.ParseOption
}

Parser wraps the raw cronexpr parser to encapsulate common configuration.

func NewParserFromConfig

func NewParserFromConfig(cfg *configv1alpha1.CronExecutionConfig) *Parser

func (*Parser) Parse

func (p *Parser) Parse(cronLine string, hashID string) (*cronexpr.Expression, error)

Parse the cronLine, with an optional hashID if HashNames is enabled.

Jump to

Keyboard shortcuts

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