Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DayOfMonthRange ¶
type DayOfMonthRange struct {
InclusiveRange
}
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.
func (*DayOfMonthRange) UnmarshalJSON ¶
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 (*DayOfMonthRange) UnmarshalYAML ¶
func (r *DayOfMonthRange) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML implements the Unmarshaller interface for DayOfMonthRange.
type InclusiveRange ¶
InclusiveRange is used to hold the Beginning and End values of many time interval components.
func (InclusiveRange) MarshalText ¶
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 (InclusiveRange) MarshalYAML ¶
func (ir InclusiveRange) MarshalYAML() (any, error)
MarshalYAML implements the yaml.Marshaler interface for InclusiveRange.
type Intervener ¶ added in v0.27.0
type Intervener struct {
// contains filtered or unexported fields
}
Intervener determines whether a given time and active route time interval should mute outgoing notifications. It implements the TimeMuter interface.
func NewIntervener ¶ added in v0.27.0
func NewIntervener(ti map[string][]TimeInterval) *Intervener
func (*Intervener) ContainsTime ¶ added in v0.35.0
ContainsTime reports whether any of the named intervals contains now, without collecting the matching names. Like Mutes, it validates every name, including those after the first match.
type Location ¶ added in v0.25.0
A Location is a container for a time.Location, used for custom unmarshalling/validation logic.
func (Location) MarshalJSON ¶ added in v0.25.0
MarshalJSON implements the json.Marshaler interface for Location.
func (Location) MarshalText ¶ added in v0.25.0
MarshalText implements the econding.TextMarshaler interface for Location. It marshals a Location back into a string that represents a time.Location.
func (Location) MarshalYAML ¶ added in v0.25.0
MarshalYAML implements the yaml.Marshaler interface for Location.
func (*Location) UnmarshalJSON ¶ added in v0.25.0
UnmarshalJSON implements the json.Unmarshaler interface for Location. It delegates to the YAML unmarshaller as it can parse JSON and has validation logic.
type MonthRange ¶
type MonthRange struct {
InclusiveRange
}
A MonthRange is an inclusive range between [1, 12] where 1 = January.
func (*MonthRange) UnmarshalJSON ¶
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 (*MonthRange) UnmarshalYAML ¶
func (r *MonthRange) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML implements the Unmarshaller interface for MonthRange.
type TimeInterval ¶
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"`
}
TimeInterval describes intervals of time. ContainsTime will tell you if a golang time is contained within the interval.
func (TimeInterval) ContainsTime ¶
func (tp TimeInterval) ContainsTime(t time.Time) bool
ContainsTime returns true if the TimeInterval contains the given time, otherwise returns false.
type TimeRange ¶
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.
func (TimeRange) MarshalJSON ¶
MarshalJSON implements the json.Marshaler interface for TimeRange.
func (TimeRange) MarshalYAML ¶
MarshalYAML implements the yaml.Marshaler interface for TimeRange.
func (*TimeRange) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for Timerange. It delegates to the YAML unmarshaller as it can parse JSON and has validation logic.
type WeekdayRange ¶
type WeekdayRange struct {
InclusiveRange
}
A WeekdayRange is an inclusive range between [0, 6] where 0 = Sunday. Begin may be greater than End to wrap around the end of the week, e.g. friday:monday.
func (WeekdayRange) MarshalText ¶
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 (WeekdayRange) MarshalYAML ¶
func (r WeekdayRange) MarshalYAML() (any, error)
MarshalYAML implements the yaml.Marshaler interface for WeekdayRange.
func (*WeekdayRange) UnmarshalJSON ¶
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 (*WeekdayRange) UnmarshalYAML ¶
func (r *WeekdayRange) UnmarshalYAML(unmarshal func(any) error) error
UnmarshalYAML implements the Unmarshaller interface for WeekdayRange.
type YearRange ¶
type YearRange struct {
InclusiveRange
}
A YearRange is a positive inclusive range.
func (*YearRange) UnmarshalJSON ¶
UnmarshalJSON implements the json.Unmarshaler interface for YearRange. It delegates to the YAML unmarshaller as it can parse JSON and has validation logic.