Help us shape the future of Go! Take the 2026 Go Developer Survey

timeRangeLib

package
v0.19.1 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2024 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

Variables

View Source
var AllowedFrequencies = []Frequency{Fixed, Daily, Weekly, WeeklyRange, Monthly}

Functions

This section is empty.

Types

type BaseTimeRangeExpressionEvaluator

type BaseTimeRangeExpressionEvaluator struct {
	TimeRange  TimeRange
	TargetTime time.Time
	// contains filtered or unexported fields
}

type DailyTimeRangeExpressionEvaluator

type DailyTimeRangeExpressionEvaluator struct {
	BaseTimeRangeExpressionEvaluator
}

type ErrorMessage

type ErrorMessage string
const (
	InvalidFrequencyType                 ErrorMessage = "invalid Frequency type"
	HourMinuteNotPresent                 ErrorMessage = "hourMinuteFrom and hourMinuteTo must be present for Daily frequency"
	TimeFromOrToNotPresent               ErrorMessage = "timeFrom and timeTo must be present for Fixed frequency"
	TimeFromLessThanTimeTo               ErrorMessage = "timeFrom must be less than timeTo for Fixed frequency"
	TimeFromEqualToTimeTo                ErrorMessage = "timeFrom must not be equal to timeTo for Fixed frequency"
	WeekDayOutsideRange                  ErrorMessage = "one or both of the values are outside the range of 0 to 6"
	WeekDaysNotPresent                   ErrorMessage = "weekdays, must be present for Weekly frequency"
	WeekDayFromOrToNotPresent            ErrorMessage = "weekdayFrom, must be present for WeeklyRange frequency"
	DayFromOrToNotPresent                ErrorMessage = "dayFrom, dayTo, must be present for Monthly frequency"
	ToBeforeFrom                         ErrorMessage = "Invalid value of hourMinuteFrom or hourMinuteTo  for same day ,hourMinuteFrom >hourMinuteTo"
	BothLessThanZeroAndFromGreaterThanTo ErrorMessage = "invalid value of DayFrom or DayTo,DayFrom and DayTo is less than zero and  dayFrom > dayTo"
	DayFromOrToNotValid                  ErrorMessage = "invalid value of dayFrom or dayTo"
)

type Frequency

type Frequency string
const (
	Fixed       Frequency = "Fixed"
	Daily       Frequency = "Daily"
	Weekly      Frequency = "Weekly"
	WeeklyRange Frequency = "WeeklyRange"
	Monthly     Frequency = "Monthly"
)

type MonthlyTimeRangeExpressionEvaluator

type MonthlyTimeRangeExpressionEvaluator struct {
	BaseTimeRangeExpressionEvaluator
}

type TimeRange

type TimeRange struct {
	TimeFrom       time.Time
	TimeTo         time.Time
	HourMinuteFrom string
	HourMinuteTo   string
	DayFrom        int
	DayTo          int
	WeekdayFrom    time.Weekday
	WeekdayTo      time.Weekday
	Weekdays       []time.Weekday
	Frequency      Frequency
}

func (TimeRange) GetTimeRangeWindow

func (tr TimeRange) GetTimeRangeWindow(targetTime time.Time) (nextWindowEdge time.Time, isTimeBetween bool, err error)

func (TimeRange) ValidateTimeRange

func (tr TimeRange) ValidateTimeRange() error

type WeeklyRangeTimeRangeExpressionEvaluator

type WeeklyRangeTimeRangeExpressionEvaluator struct {
	BaseTimeRangeExpressionEvaluator
}

type WeeklyTimeRangeExpressionEvaluator

type WeeklyTimeRangeExpressionEvaluator struct {
	BaseTimeRangeExpressionEvaluator
}

Jump to

Keyboard shortcuts

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