Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type TimePeriod ¶
TimePeriod is a basic type which will know whether a period in time contains data
func CalculateTimePeriodsInRange ¶
CalculateTimePeriodsInRange can break down start and end times into time periods eg 1 hourly intervals
type TimePeriodCalculator ¶
type TimePeriodCalculator struct { TimePeriods []TimePeriod TimeRanges []TimeRange // contains filtered or unexported fields }
TimePeriodCalculator is able analyse a time span and either break them down into chunks, or determine ranges that contain data or not
func (*TimePeriodCalculator) Sort ¶
func (t *TimePeriodCalculator) Sort(desc bool)
Sort will sort the time period asc or desc
type TimeRange ¶
TimeRange holds a start and end dat range and whether that range contains data
func FindTimeRangesContainingData ¶
func FindTimeRangesContainingData(start, end time.Time, period time.Duration, comparisonTimes []time.Time) ([]TimeRange, error)
FindTimeRangesContainingData will break the start and end into time periods using the provided period it will then check whether any comparisonTimes are within those periods and concatenate them eg if no comparisonTimes match, you will receive 1 TimeRange of Start End with dataInRange = false eg2 if 1 comparisonTime matches in the middle of start and end, you will receive three ranges