datum

package
v3.0.0-rc9+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2018 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFloat

func GetFloat(d Datum) float64

func GetInt

func GetInt(d Datum) int64

func IncIntBy

func IncIntBy(d Datum, v int64, ts time.Time)

func SetFloat

func SetFloat(d Datum, v float64, ts time.Time)

func SetInt

func SetInt(d Datum, v int64, ts time.Time)

Types

type BaseDatum

type BaseDatum struct {
	Time int64 // nanoseconds since unix epoch
}

func (*BaseDatum) TimeString

func (d *BaseDatum) TimeString() string

type Datum

type Datum interface {
	// Type returns the Datum type.
	Type() Type

	ValueString() string

	TimeString() string
}

Datum

func MakeFloat

func MakeFloat(v float64, ts time.Time) Datum

func MakeInt

func MakeInt(v int64, ts time.Time) Datum

func NewFloat

func NewFloat() Datum

func NewInt

func NewInt() Datum

type FloatDatum

type FloatDatum struct {
	BaseDatum
	Valuebits uint64
}

floatDatum describes a floating point value at a given timestamp.

func (*FloatDatum) Get

func (d *FloatDatum) Get() float64

func (*FloatDatum) MarshalJSON

func (d *FloatDatum) MarshalJSON() ([]byte, error)

func (*FloatDatum) Set

func (d *FloatDatum) Set(v float64, ts time.Time)

func (*FloatDatum) String

func (d *FloatDatum) String() string

func (*FloatDatum) Type

func (*FloatDatum) Type() Type

func (*FloatDatum) ValueString

func (d *FloatDatum) ValueString() string

type IntDatum

type IntDatum struct {
	BaseDatum
	Value int64
}

IntDatum describes an integer value at a given timestamp.

func (*IntDatum) Get

func (d *IntDatum) Get() int64

Get returns the value of the Datum.

func (*IntDatum) IncBy

func (d *IntDatum) IncBy(delta int64, timestamp time.Time)

IncBy implements the Incrementable interface for a Datum.

func (*IntDatum) MarshalJSON

func (d *IntDatum) MarshalJSON() ([]byte, error)

func (*IntDatum) Set

func (d *IntDatum) Set(value int64, timestamp time.Time)

Set implements the Settable interface for a Datum.

func (*IntDatum) String

func (d *IntDatum) String() string

func (*IntDatum) Type

func (*IntDatum) Type() Type

func (*IntDatum) ValueString

func (d *IntDatum) ValueString() string

type Type

type Type int
const (
	Int Type = iota
	Float
)

func (Type) String

func (t Type) String() string

Jump to

Keyboard shortcuts

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