helpers

package
v2.8.0 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2025 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CheckOverlap added in v2.6.0

func CheckOverlap(range1, range2 string, maxValue int) (bool, error)

CheckOverlap is a function to check if two ranges overlap

func DaysOverlap added in v2.6.0

func DaysOverlap(dom1, dow1, dom2, dow2 string) (bool, error)

DaysOverlap checks if two day ranges overlap, considering both DOM and DOW. Returns true if both DOM and DOW overlap, or if one is * and the other overlaps.

func DomOverlap added in v2.6.0

func DomOverlap(dom1, dom2 string) (bool, error)

DomOverlap checks if two day-of-month ranges overlap

func DowOverlap added in v2.6.0

func DowOverlap(dow1, dow2 string) (bool, error)

DowOverlap checks if two day-of-week ranges overlap

func HoursOverlap added in v2.6.0

func HoursOverlap(hours1, hours2 string) (bool, error)

HoursOverlap checks if two hour ranges overlap

func MonthsOverlap added in v2.6.0

func MonthsOverlap(months1, months2 string) (bool, error)

MonthsOverlap checks if two month ranges overlap

func OptionalEnv

func OptionalEnv(name string) string

OptionalEnv returns the value for environment variable if it exists, otherwise returns an empty string.

func OptionalEnvOrDefault

func OptionalEnvOrDefault(name, defaultValue string) string

OptionalEnvOrDefault returns the value for environment variable if it exists, otherwise returns the default value.

func ParseRange added in v2.6.0

func ParseRange(input string, maxValue int) (map[int]bool, error)

ParseRange converts a cron range to a set of integers maxValue is the maximum allowed value (e.g., 23 for hours, 6 for DOW, 12 for months, 31 for DOM)

func RequireEnv

func RequireEnv(name string) (string, error)

RequireEnv requires environment variable to be present. The constraint can be verified only during execution of the workspace build (determined with env `CODER_WORKSPACE_BUILD_ID`).

func SchedulesOverlap added in v2.6.0

func SchedulesOverlap(schedule1, schedule2 string) (bool, error)

SchedulesOverlap checks if two schedules overlap by checking all cron fields separately

func ValidateSchedules added in v2.6.0

func ValidateSchedules(schedules []string) error

ValidateSchedules checks if any schedules overlap

Types

This section is empty.

Jump to

Keyboard shortcuts

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