schedule

package
v2.0.0-beta.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IsAfterTimeRanges

func IsAfterTimeRanges(now time.Time, ranges []DatetimeRange) bool

func IsInRunningSchedule

func IsInRunningSchedule(cronExpr string, now time.Time, d time.Duration) (bool, time.Duration, error)

IsInRunningSchedule checks whether the rule should be running, eg: If the duration is 10min, and cron is "0 0 * * *", and the current time is 00:00:02 And the rule should be started immediately instead of checking it on the next day.

func IsInScheduleRanges

func IsInScheduleRanges(now time.Time, timeRanges []DatetimeRange) (bool, error)

func ValidateRanges

func ValidateRanges(ranges []DatetimeRange) error

Types

type DatetimeRange

type DatetimeRange struct {
	Begin          string `json:"begin" yaml:"begin"`
	End            string `json:"end" yaml:"end"`
	BeginTimestamp int64  `json:"beginTimestamp" yaml:"beginTimestamp"`
	EndTimestamp   int64  `json:"endTimestamp" yaml:"endTimestamp"`
}

Jump to

Keyboard shortcuts

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