interval

package
v2.20.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 9, 2024 License: MIT Imports: 11 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregatePriorMonths

func AggregatePriorMonths(ds timeseries.TimeSeries, start time.Time, months uint) int64

Types

type SeriesIntervals

type SeriesIntervals struct {
	Interval        timeutil.Interval
	WeekStart       time.Weekday
	Max             time.Time
	Min             time.Time
	CanonicalSeries []time.Time
}

func (*SeriesIntervals) Inflate

func (ival *SeriesIntervals) Inflate() error

func (*SeriesIntervals) ProcItemsMap

func (ival *SeriesIntervals) ProcItemsMap(itemMap map[string]timeseries.TimeItem)

type SeriesType

type SeriesType int
const (
	Source SeriesType = iota
	Output
	OutputAggregate
)

type TimeSeriesSet

type TimeSeriesSet struct {
	SourceSeriesMap          map[string]timeseries.TimeSeries
	OutputSeriesMap          map[string]timeseries.TimeSeries
	OutputAggregateSeriesMap map[string]timeseries.TimeSeries
	SeriesIntervals          SeriesIntervals
	AllSeriesName            string
}

TimeSeriesSet is used to prepare histogram data for static timeseries charts, adding zero values for time slots as necessary. Usage is to create to call: NewTimeSeriesSet("quarter"), AddItem() and then Inflate()

func NewTimeSeriesSet

func NewTimeSeriesSet(interval timeutil.Interval, weekStart time.Weekday) TimeSeriesSet

func (*TimeSeriesSet) AddItem

func (set *TimeSeriesSet) AddItem(item timeseries.TimeItem)

func (*TimeSeriesSet) BuildOutputSeries

func (set *TimeSeriesSet) BuildOutputSeries(source timeseries.TimeSeries) (timeseries.TimeSeries, error)

func (*TimeSeriesSet) FlattenData

func (set *TimeSeriesSet) FlattenData() map[string][]time.Time

func (*TimeSeriesSet) GetTimeSeries

func (set *TimeSeriesSet) GetTimeSeries(seriesName string, seriesType SeriesType) (timeseries.TimeSeries, error)

func (*TimeSeriesSet) Inflate

func (set *TimeSeriesSet) Inflate() error

func (*TimeSeriesSet) SeriesNamesSorted

func (set *TimeSeriesSet) SeriesNamesSorted() []string

type XoXGrowth

type XoXGrowth struct {
	DateMap map[string]XoxPoint
	YTD     int64
	QTD     int64
}

func NewXoXTimeSeries

func NewXoXTimeSeries(ds timeseries.TimeSeries) (XoXGrowth, error)

func (*XoXGrowth) Last

func (xg *XoXGrowth) Last() XoxPoint

type XoxPoint

type XoxPoint struct {
	Time           time.Time
	TimeMonthAgo   time.Time
	TimeQuarterAgo time.Time
	TimeYearAgo    time.Time
	Value          int64
	YOldValue      int64
	QOldValue      int64
	MOldValue      int64
	YNowValue      int64
	QNowValue      int64
	MNowValue      int64
	MYAgoValue     int64
	MQAgoValue     int64
	MMAgoValue     int64
	AggregateValue int64
	YoY            float64
	QoQ            float64
	MoM            float64
	YoYAggregate   float64
	QoQAggregate   float64
	MoMAggregate   float64
}

type YoYQoQGrowth

type YoYQoQGrowth struct {
	DateMap map[string]XoxPoint
	YTD     int64
	QTD     int64
}

func AddYtdAndQtd

func AddYtdAndQtd(yoy YoYQoQGrowth) YoYQoQGrowth

func NewYoYQoQGrowth

func NewYoYQoQGrowth(set TimeSeriesSet) (YoYQoQGrowth, error)

func (*YoYQoQGrowth) ItemsSorted

func (yoy *YoYQoQGrowth) ItemsSorted() []XoxPoint

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL