Documentation ¶
Overview ¶
Package timeinterval is time range data structure ,many trade system has this. code inspired by Altermanager
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) UnmarshalText ¶
func (dr *DayOfMonthRange) UnmarshalText(in []byte) error
type InclusiveRange ¶
InclusiveRange is used to hold the Beginning and End values of many time interval components.
type Location ¶
A Location is a container for a time.Location, used for custom unmarshalling/validation logic.
func (*Location) UnmarshalText ¶
type MonthRange ¶
type MonthRange struct {
InclusiveRange
}
A MonthRange is an inclusive range between [1, 12] where 1 = January.
func (*MonthRange) UnmarshalText ¶
func (mr *MonthRange) UnmarshalText(in []byte) error
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:"daysOfMonth,flow,omitempty" json:"daysOfMonth,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 (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) UnmarshalText ¶
type WeekdayRange ¶
type WeekdayRange struct {
InclusiveRange
}
A WeekdayRange is an inclusive range between [0, 6] where 0 = Sunday.
func (*WeekdayRange) UnmarshalText ¶
func (wr *WeekdayRange) UnmarshalText(in []byte) error
type YearRange ¶
type YearRange struct {
InclusiveRange
}
A YearRange is a positive inclusive range.