interval

package
v1.5.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AggregatePriorMonths

func AggregatePriorMonths(ds statictimeseries.DataSeries, start time.Time, months uint) int64

Types

type DataSeriesSet

type DataSeriesSet struct {
	SourceSeriesMap          map[string]statictimeseries.DataSeries
	OutputSeriesMap          map[string]statictimeseries.DataSeries
	OutputAggregateSeriesMap map[string]statictimeseries.DataSeries
	SeriesIntervals          SeriesIntervals
	AllSeriesName            string
}

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

func EsAggsToDataSeriesSet

func EsAggsToDataSeriesSet(aggs []v5.AggregationResRad, interval timeutil.Interval, weekStart time.Weekday) DataSeriesSet

func NewDataSeriesSet

func NewDataSeriesSet(interval timeutil.Interval, weekStart time.Weekday) DataSeriesSet

func (*DataSeriesSet) AddItem

func (set *DataSeriesSet) AddItem(item statictimeseries.DataItem)

func (*DataSeriesSet) BuildOutputSeries

func (set *DataSeriesSet) BuildOutputSeries(source statictimeseries.DataSeries) (statictimeseries.DataSeries, error)

func (*DataSeriesSet) FlattenData

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

func (*DataSeriesSet) GetDataSeries

func (set *DataSeriesSet) GetDataSeries(seriesName string, seriesType SeriesType) (statictimeseries.DataSeries, error)

func (*DataSeriesSet) Inflate

func (set *DataSeriesSet) Inflate() error

func (*DataSeriesSet) SeriesNamesSorted

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

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]statictimeseries.DataItem)

type SeriesType

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

type XoXGrowth

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

func NewXoXDataSeries

func NewXoXDataSeries(ds statictimeseries.DataSeries) (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 DataSeriesSet) (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