schedule

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Oct 3, 2024 License: BSD-3-Clause Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrNoNextFound = fmt.Errorf("no next time found")

ErrNoNextFound is returned when no no next time could be found

Functions

This section is empty.

Types

type Schedule

type Schedule struct {
	cron.Schedule

	// The week of the year to run the job
	// 1-53 or @odd, @even
	// Empty matches any week of the year
	IsoWeek string
}

Schedule is a wrapper around cron.Schedule that adds the IsoWeek field

func (Schedule) Next

func (s Schedule) Next(earliest time.Time) (time.Time, error)

Next returns the next activation time of the schedule after the earliest time. If the schedule is invalid, it will return an error. If the schedule is valid but no next time could be found (too far in the future), it will return an error with ErrNoNextFound.

func (Schedule) NextN

func (s Schedule) NextN(earliest time.Time, n int) ([]time.Time, error)

NextN returns the next n activation times of the schedule after the earliest time. If the schedule is invalid, it will return an error. If the schedule is valid but no next time could be found (too far in the future), it will return an error with ErrNoNextFound. If an error occurs the returned slice will contain len() valid activation times that were found before the error occurred.

Jump to

Keyboard shortcuts

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