TimeLayout specifies the layout to be used in time.Parse() calls for time intervals.
const TimeLayout = "15:04"
A DayOfMonthRange is an inclusive range that may have negative Beginning/End values that represent distance from the End of the month Beginning at -1.
type DayOfMonthRange struct { InclusiveRange }
func (r *DayOfMonthRange) UnmarshalJSON(in []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for DayOfMonthRange. It delegates to the YAML unmarshaller as it can parse JSON and has validation logic.
func (r *DayOfMonthRange) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the Unmarshaller interface for DayOfMonthRange.
InclusiveRange is used to hold the Beginning and End values of many time interval components.
type InclusiveRange struct { Begin int End int }
func (ir InclusiveRange) MarshalText() ([]byte, error)
MarshalText implements the encoding.TextMarshaler interface for InclusiveRange. It converts the struct into a colon-separated string, or a single element if appropriate. e.g. "monday:friday" or "monday"
func (ir InclusiveRange) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaler interface for InclusiveRange.
A Location is a container for a time.Location, used for custom unmarshalling/validation logic.
type Location struct { *time.Location }
func (tz Location) MarshalJSON() (out []byte, err error)
MarshalJSON implements the json.Marshaler interface for Location.
func (tz Location) MarshalText() ([]byte, error)
MarshalText implements the econding.TextMarshaler interface for Location. It marshals a Location back into a string that represents a time.Location.
func (tz Location) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaler interface for Location.
func (tz *Location) UnmarshalJSON(in []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for Location. It delegates to the YAML unmarshaller as it can parse JSON and has validation logic.
func (tz *Location) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the Unmarshaller interface for Location.
A MonthRange is an inclusive range between [1, 12] where 1 = January.
type MonthRange struct { InclusiveRange }
func (r *MonthRange) UnmarshalJSON(in []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for MonthRange. It delegates to the YAML unmarshaller as it can parse JSON and has validation logic.
func (r *MonthRange) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the Unmarshaller interface for MonthRange.
TimeInterval describes intervals of time. ContainsTime will tell you if a golang time is contained within the interval.
type TimeInterval struct { Times []TimeRange `yaml:"times,omitempty" json:"times,omitempty"` Weekdays []WeekdayRange `yaml:"weekdays,flow,omitempty" json:"weekdays,omitempty"` DaysOfMonth []DayOfMonthRange `yaml:"days_of_month,flow,omitempty" json:"days_of_month,omitempty"` Months []MonthRange `yaml:"months,flow,omitempty" json:"months,omitempty"` Years []YearRange `yaml:"years,flow,omitempty" json:"years,omitempty"` Location *Location `yaml:"location,flow,omitempty" json:"location,omitempty"` }
func (tp TimeInterval) ContainsTime(t time.Time) bool
ContainsTime returns true if the TimeInterval contains the given time, otherwise returns false.
TimeRange represents a range of minutes within a 1440 minute day, exclusive of the End minute. A day consists of 1440 minutes. For example, 4:00PM to End of the day would Begin at 1020 and End at 1440.
type TimeRange struct { StartMinute int EndMinute int }
func (tr TimeRange) MarshalJSON() (out []byte, err error)
MarshalJSON implements the json.Marshaler interface for TimeRange.
func (tr TimeRange) MarshalYAML() (out interface{}, err error)
MarshalYAML implements the yaml.Marshaler interface for TimeRange.
func (tr *TimeRange) UnmarshalJSON(in []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for Timerange. It delegates to the YAML unmarshaller as it can parse JSON and has validation logic.
func (tr *TimeRange) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the Unmarshaller interface for TimeRanges.
A WeekdayRange is an inclusive range between [0, 6] where 0 = Sunday.
type WeekdayRange struct { InclusiveRange }
func (r WeekdayRange) MarshalText() ([]byte, error)
MarshalText implements the econding.TextMarshaler interface for WeekdayRange. It converts the range into a colon-separated string, or a single weekday if possible. e.g. "monday:friday" or "saturday".
func (r WeekdayRange) MarshalYAML() (interface{}, error)
MarshalYAML implements the yaml.Marshaler interface for WeekdayRange.
func (r *WeekdayRange) UnmarshalJSON(in []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for WeekdayRange. It delegates to the YAML unmarshaller as it can parse JSON and has validation logic.
func (r *WeekdayRange) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the Unmarshaller interface for WeekdayRange.
A YearRange is a positive inclusive range.
type YearRange struct { InclusiveRange }
func (r *YearRange) UnmarshalJSON(in []byte) error
UnmarshalJSON implements the json.Unmarshaler interface for YearRange. It delegates to the YAML unmarshaller as it can parse JSON and has validation logic.
func (r *YearRange) UnmarshalYAML(unmarshal func(interface{}) error) error
UnmarshalYAML implements the Unmarshaller interface for YearRange.