cron

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

Package cron compiles documented five- or six-field cron expressions in an explicit IANA time zone without exposing the underlying parser implementation.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrInvalidExpression reports a cron expression rejected by the parser.
	ErrInvalidExpression = errors.New("scheduler cron: invalid expression")
	// ErrInvalidTimezone reports an unavailable IANA time-zone name.
	ErrInvalidTimezone = errors.New("scheduler cron: invalid timezone")
)

Functions

This section is empty.

Types

type Schedule

type Schedule interface {
	Next(time.Time) time.Time
}

Schedule calculates the first occurrence strictly after a timestamp.

func Compile

func Compile(expression, timezone string) (Schedule, error)

Compile validates an expression and time zone and returns an immutable schedule. Expressions use the standard five-field format, an optional leading seconds field, an L day-of-month value, or descriptors supported by robfig/cron/v3. Calendar searches cover a complete 400-year Gregorian cycle before reporting no future occurrence.

Jump to

Keyboard shortcuts

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