Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Entry ¶
type Entry struct { baseconf.IncrementalPkDbEntry[int64] `db:",inline"` TimePeriodID int64 `db:"timeperiod_id"` StartTime types.UnixMilli `db:"start_time"` EndTime types.UnixMilli `db:"end_time"` Timezone string `db:"timezone"` RRule sql.NullString `db:"rrule"` // RFC5545 RRULE RotationMemberID sql.NullInt64 `db:"rotation_member_id"` // contains filtered or unexported fields }
func (*Entry) Contains ¶
Contains returns whether a point in time t is covered by this entry.
This function may only be called after a successful call to Init().
func (*Entry) IncrementalInitAndValidate ¶
IncrementalInitAndValidate implements the config.IncrementalConfigurableInitAndValidatable interface.
func (*Entry) Init ¶
Init prepares the Entry for use after being read from the database.
This includes loading the timezone information and parsing the recurrence rule if present.
func (*Entry) MarshalLogObject ¶
func (e *Entry) MarshalLogObject(encoder zapcore.ObjectEncoder) error
MarshalLogObject implements the zapcore.ObjectMarshaler interface.
func (*Entry) NextTransition ¶
NextTransition returns the next recurrence start or end of this entry relative to the given time inclusively. This function returns also time.Time's zero value if there is no transition that starts/ends at/after the specified time.
This function may only be called after a successful call to Init().
type TimePeriod ¶
type TimePeriod struct { baseconf.IncrementalPkDbEntry[int64] `db:",inline"` Name string `db:"-"` Entries []*Entry `db:"-"` }
func (*TimePeriod) Contains ¶
func (p *TimePeriod) Contains(t time.Time) bool
Contains returns whether a point in time t is covered by this time period, i.e. there is an entry covering it.
func (*TimePeriod) IncrementalInitAndValidate ¶
func (p *TimePeriod) IncrementalInitAndValidate() error
func (*TimePeriod) MarshalLogObject ¶
func (p *TimePeriod) MarshalLogObject(encoder zapcore.ObjectEncoder) error
MarshalLogObject implements the zapcore.ObjectMarshaler interface.
func (*TimePeriod) NextTransition ¶
func (p *TimePeriod) NextTransition(base time.Time) time.Time
NextTransition returns a time strictly after the given base time when the time period may be entered or exited.
It is guaranteed that for any time t with base < t < p.NextTransition(base), p.Contains(t) == p.Contains(base), i.e. the earliest time a change happens, is at the returned time. Note that for simplicity of the implementation, this specification does not require that a transition happens at the returned time.
func (*TimePeriod) TableName ¶
func (p *TimePeriod) TableName() string