ts

package
v0.0.0-...-9b2c719 Latest Latest
Warning

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

Go to latest
Published: Mar 12, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Bucket

type Bucket struct {
	T time.Time `json:"time"`
	V float64   `json:"value"`
}

Bucket represents a value at a given point in time

type Series

type Series struct {
	Duration   time.Duration
	Resolution time.Duration
	// contains filtered or unexported fields
}

Series represents a single time-series.

func New

func New(duration time.Duration, resolution time.Duration) *Series

New creates a new Series with the given duration and resolution

func (*Series) FromDuration

func (s *Series) FromDuration(d time.Duration) []*Bucket

FromDuration returns a range of Buckets, between Now and Now - d

func (*Series) Insert

func (s *Series) Insert(t time.Time, value float64)

Insert takes a given value at a given time and inserts a new bucket into the Series given the spec

func (*Series) Range

func (s *Series) Range(start time.Time, end time.Time) []*Bucket

Range takes a start and end time and returns a list of buckets that match

Jump to

Keyboard shortcuts

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