Documentation ¶
Index ¶
- func TimeRangeNames() []string
- type File
- type Jailhouse
- func (x *Jailhouse[T]) AddElements(elems ...T) *Jailhouse[T]
- func (x *Jailhouse[T]) ApplyRequirements(reqs Requirements) *Jailhouse[T]
- func (x *Jailhouse[T]) ApplyRequirementsForDate(reqs Requirements, referenceDate time.Time) *Jailhouse[T]
- func (x *Jailhouse[T]) Elements() []*JailhouseTimeResource[T]
- func (x *Jailhouse[T]) FilteredElements(filter func(*JailhouseTimeResource[T]) bool) []*JailhouseTimeResource[T]
- func (x *Jailhouse[T]) FreeElements() []*JailhouseTimeResource[T]
- func (x *Jailhouse[T]) GetLevels() []TimeRange
- func (x *Jailhouse[T]) KeptElements() []*JailhouseTimeResource[T]
- func (x *Jailhouse[T]) KeptElementsByLevel(level TimeRange) []*JailhouseTimeResource[T]
- type JailhouseTimeResource
- func (x *JailhouseTimeResource[T]) AddTag(tag TimeRangeTag) *JailhouseTimeResource[T]
- func (x *JailhouseTimeResource[T]) ClearTags() *JailhouseTimeResource[T]
- func (x JailhouseTimeResource[T]) GetTags() []TimeRangeTag
- func (x JailhouseTimeResource[T]) GetTime() time.Time
- func (x *JailhouseTimeResource[T]) HasLevel(level TimeRange) bool
- func (x JailhouseTimeResource[T]) IsFree() bool
- func (x JailhouseTimeResource[T]) String() string
- type Requirements
- type TimeRange
- type TimeRangeTag
- type TimeResource
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func TimeRangeNames ¶
func TimeRangeNames() []string
TimeRangeNames returns a list of possible string values of TimeRange.
Types ¶
type Jailhouse ¶
type Jailhouse[T TimeResource] struct { // contains filtered or unexported fields }
func NewDefaultJailhouse ¶
func NewDefaultJailhouse[T TimeResource]() *Jailhouse[T]
func (*Jailhouse[T]) AddElements ¶
func (*Jailhouse[T]) ApplyRequirements ¶
func (x *Jailhouse[T]) ApplyRequirements(reqs Requirements) *Jailhouse[T]
func (*Jailhouse[T]) ApplyRequirementsForDate ¶
func (x *Jailhouse[T]) ApplyRequirementsForDate(reqs Requirements, referenceDate time.Time) *Jailhouse[T]
func (*Jailhouse[T]) Elements ¶
func (x *Jailhouse[T]) Elements() []*JailhouseTimeResource[T]
func (*Jailhouse[T]) FilteredElements ¶
func (x *Jailhouse[T]) FilteredElements(filter func(*JailhouseTimeResource[T]) bool) []*JailhouseTimeResource[T]
func (*Jailhouse[T]) FreeElements ¶
func (x *Jailhouse[T]) FreeElements() []*JailhouseTimeResource[T]
func (*Jailhouse[T]) KeptElements ¶
func (x *Jailhouse[T]) KeptElements() []*JailhouseTimeResource[T]
func (*Jailhouse[T]) KeptElementsByLevel ¶
func (x *Jailhouse[T]) KeptElementsByLevel(level TimeRange) []*JailhouseTimeResource[T]
type JailhouseTimeResource ¶
type JailhouseTimeResource[T TimeResource] struct { Tags []TimeRangeTag TimeResource T }
JailhouseTimeResource is an TimeResource with annotated Jailhouse data
func NewJailhouseTimeResource ¶
func NewJailhouseTimeResource[T TimeResource](resource T) *JailhouseTimeResource[T]
func (*JailhouseTimeResource[T]) AddTag ¶
func (x *JailhouseTimeResource[T]) AddTag(tag TimeRangeTag) *JailhouseTimeResource[T]
func (*JailhouseTimeResource[T]) ClearTags ¶
func (x *JailhouseTimeResource[T]) ClearTags() *JailhouseTimeResource[T]
func (JailhouseTimeResource[T]) GetTags ¶
func (x JailhouseTimeResource[T]) GetTags() []TimeRangeTag
func (JailhouseTimeResource[T]) GetTime ¶
func (x JailhouseTimeResource[T]) GetTime() time.Time
func (*JailhouseTimeResource[T]) HasLevel ¶
func (x *JailhouseTimeResource[T]) HasLevel(level TimeRange) bool
func (JailhouseTimeResource[T]) IsFree ¶
func (x JailhouseTimeResource[T]) IsFree() bool
func (JailhouseTimeResource[T]) String ¶
func (x JailhouseTimeResource[T]) String() string
type Requirements ¶
type Requirements struct {
// contains filtered or unexported fields
}
Requirements define which elements in an input slice should be kept
func NewRequirements ¶
func NewRequirements() *Requirements
NewRequirements creates a new empty Requirement definition.
func NewRequirementsFromMap ¶
func NewRequirementsFromMap(data map[TimeRange]uint16) *Requirements
NewRequirementsFromMap makes a Requirement from a map with TimeRange as keys and their number as values.
func NewRequirementsFromString ¶
func NewRequirementsFromString(source string) *Requirements
func (*Requirements) Add ¶
func (x *Requirements) Add(timeRange TimeRange, value int8) *Requirements
Add adds a number of required elements for a given TimeRange.
func (Requirements) DeepCopy ¶
func (x Requirements) DeepCopy() Requirements
DeepCopy returns a Requirement copy with the same properties.
func (Requirements) Get ¶
func (x Requirements) Get(timeRange TimeRange) uint16
Get returns the number of elements in this Requirement for a given TimeRange.
func (Requirements) IsEmpty ¶
func (x Requirements) IsEmpty() bool
IsEmpty is true iff no files should be kept.
func (Requirements) String ¶
func (x Requirements) String() string
String prints a Requirement configuration
type TimeRange ¶
type TimeRange int8
ENUM( LAST SECOND MINUTE HOUR DAY WEEK MONTH QUARTER YEAR DECADE CENTURY MILLENIUM
)
const ( // LAST is a TimeRange of type LAST. LAST TimeRange = iota // SECOND is a TimeRange of type SECOND. SECOND // MINUTE is a TimeRange of type MINUTE. MINUTE // HOUR is a TimeRange of type HOUR. HOUR // DAY is a TimeRange of type DAY. DAY // WEEK is a TimeRange of type WEEK. WEEK // MONTH is a TimeRange of type MONTH. MONTH // QUARTER is a TimeRange of type QUARTER. QUARTER // YEAR is a TimeRange of type YEAR. YEAR // DECADE is a TimeRange of type DECADE. DECADE // CENTURY is a TimeRange of type CENTURY. CENTURY // MILLENIUM is a TimeRange of type MILLENIUM. MILLENIUM )
func MustParseTimeRange ¶
MustParseTimeRange converts a string to a TimeRange, and panics if is not valid.
func ParseTimeRange ¶
ParseTimeRange attempts to convert a string to a TimeRange.
type TimeRangeTag ¶
func TimeRangeTagFrom ¶
func TimeRangeTagFrom(timeRange TimeRange, index uint16) TimeRangeTag
func (TimeRangeTag) String ¶
func (x TimeRangeTag) String() string
type TimeResource ¶
TimeResource is an element with an associated time