timeseries

package
Version: v0.0.0-...-54de7ac Latest Latest
Warning

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

Go to latest
Published: Dec 22, 2017 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DataPoint

type DataPoint struct {
	Time  int64   `json:"time"`
	Value float64 `json:"value"`
}

DataPoint struct

type Timeseries

type Timeseries struct {
	*sync.RWMutex
	// contains filtered or unexported fields
}

Timeseries struct

func New

func New(size int) *Timeseries

New Timeseries

func (*Timeseries) Add

func (ts *Timeseries) Add(t int64, v float64)

Add DataPoint to Timeseries

func (Timeseries) All

func (ts Timeseries) All() []*DataPoint

All DataPoint in Timeseries

func (Timeseries) GetLatestValues

func (ts Timeseries) GetLatestValues(size int) []float64

GetLatestValues by size

func (Timeseries) GetTrending

func (ts Timeseries) GetTrending(size int) (TrendType, error)

GetTrending for timeseries

func (Timeseries) Keys

func (ts Timeseries) Keys() []int64

Keys slice

func (Timeseries) MaxValue

func (ts Timeseries) MaxValue() float64

MaxValue of Timeseries

func (*Timeseries) Size

func (ts *Timeseries) Size() int

Size of timeseries

func (Timeseries) Values

func (ts Timeseries) Values() []float64

Values slice

type TrendType

type TrendType int

TrendType type

const (
	TrendTypeDecreasing TrendType = -1
	TrendTypeNeutral    TrendType = 0
	TrendTypeIncreasing TrendType = 1
)

TrendType enum

Source Files

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL