models

package
v1.3.3 Latest Latest
Warning

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

Go to latest
Published: Aug 11, 2017 License: MIT Imports: 9 Imported by: 0

Documentation

Overview

Provides a set of structures for passing data around Kapacitor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func SortedFields

func SortedFields(fields Fields) []string

func SortedKeys

func SortedKeys(tags map[string]string) []string

Types

type Batch

type Batch struct {
	Name   string       `json:"name,omitempty"`
	TMax   time.Time    `json:"tmax,omitempty"`
	Group  GroupID      `json:"group,omitempty"`
	ByName bool         `json:"byname,omitempty"`
	Tags   Tags         `json:"tags,omitempty"`
	Points []BatchPoint `json:"points,omitempty"`
}

func ResultToBatches

func ResultToBatches(res influxdb.Result, groupByName bool) ([]Batch, error)

func (Batch) Copy added in v0.11.0

func (b Batch) Copy() PointInterface

func (*Batch) Interface added in v1.0.0

func (b *Batch) Interface() PointInterface

func (Batch) PointDimensions

func (b Batch) PointDimensions() Dimensions

func (Batch) PointFields

func (b Batch) PointFields() Fields

func (Batch) PointGroup

func (b Batch) PointGroup() GroupID

func (Batch) PointName

func (b Batch) PointName() string

func (Batch) PointTags

func (b Batch) PointTags() Tags

func (Batch) PointTime

func (b Batch) PointTime() time.Time

func (*Batch) SetNewDimTag added in v0.11.0

func (b *Batch) SetNewDimTag(key string, value string)

func (Batch) Setter added in v0.11.0

func (b Batch) Setter() PointSetter

func (Batch) ShallowCopyPoints added in v1.3.0

func (b Batch) ShallowCopyPoints() []BatchPoint

ShallowCopyPoints creates a new slice for the points but only shallow copies the points themselves. Then if a single point needs to be modified it must first be copied.

func (*Batch) UpdateGroup added in v0.11.0

func (b *Batch) UpdateGroup()

type BatchPoint

type BatchPoint struct {
	Time   time.Time `json:"time"`
	Fields Fields    `json:"fields"`
	Tags   Tags      `json:"tags"`
}

A point in batch, similar to Point but most information is found on the containing Batch.

Tags on a BatchPoint are a superset of the tags on the Batch All points in a batch should have the same tag and field keys.

func BatchPointFromPoint

func BatchPointFromPoint(p Point) BatchPoint

type Dimensions added in v0.11.0

type Dimensions struct {
	ByName   bool
	TagNames []string
}

func (Dimensions) Copy added in v0.11.0

func (d Dimensions) Copy() Dimensions

func (Dimensions) ToSet added in v1.0.0

func (d Dimensions) ToSet() map[string]bool

type Fields

type Fields map[string]interface{}

func (Fields) Copy

func (f Fields) Copy() Fields

type GroupID

type GroupID string
const (
	NilGroup GroupID = ""
)

func ToGroupID added in v1.0.0

func ToGroupID(name string, tags map[string]string, dims Dimensions) GroupID

type Point

type Point struct {
	Name            string
	Database        string
	RetentionPolicy string

	Group      GroupID
	Dimensions Dimensions

	Tags Tags

	Fields Fields

	Time time.Time
}

Represents a single data point

func (Point) Bytes

func (p Point) Bytes(precision string) []byte

Returns byte array of a line protocol representation of the point

func (Point) Copy added in v0.11.0

func (p Point) Copy() PointInterface

func (*Point) Interface added in v1.0.0

func (p *Point) Interface() PointInterface

func (Point) PointDimensions

func (p Point) PointDimensions() Dimensions

func (Point) PointFields

func (p Point) PointFields() Fields

func (Point) PointGroup

func (p Point) PointGroup() GroupID

func (Point) PointName

func (p Point) PointName() string

func (Point) PointTags

func (p Point) PointTags() Tags

func (Point) PointTime

func (p Point) PointTime() time.Time

func (*Point) SetNewDimTag added in v0.11.0

func (p *Point) SetNewDimTag(key string, value string)

func (Point) Setter added in v0.11.0

func (p Point) Setter() PointSetter

func (*Point) UpdateGroup added in v0.11.0

func (p *Point) UpdateGroup()

type PointInterface

type PointInterface interface {
	PointName() string
	PointTime() time.Time
	PointGroup() GroupID
	PointTags() Tags
	PointDimensions() Dimensions
	PointFields() Fields

	// Return a copy of self
	Copy() PointInterface
	Setter() PointSetter
}

Common interface for both Point and Batch objects

type PointSetter added in v0.11.0

type PointSetter interface {
	PointInterface
	SetNewDimTag(key string, value string)
	UpdateGroup()
	Interface() PointInterface
}

type RawPoint added in v1.0.0

type RawPoint struct {
	Time   time.Time
	Fields Fields
	Tags   Tags
}

Simple container for point data.

type Result added in v1.3.0

type Result struct {
	Series Rows  `json:"series"`
	Err    error `json:"error,omitempty"`
}

func BatchToResult added in v1.3.0

func BatchToResult(b Batch) Result

func (Result) String added in v1.3.0

func (r Result) String() string

type Row added in v1.3.0

type Row struct {
	Name    string            `json:"name,omitempty"`
	Tags    map[string]string `json:"tags,omitempty"`
	Columns []string          `json:"columns,omitempty"`
	Values  [][]interface{}   `json:"values,omitempty"`
}

Row represents a single row returned from the execution of a statement.

func BatchToRow

func BatchToRow(b Batch) (row *Row)

func PointToRow

func PointToRow(p Point) (row *Row)

func (*Row) UnmarshalJSON added in v1.3.0

func (r *Row) UnmarshalJSON(data []byte) error

type Rows added in v1.3.0

type Rows []*Row

Rows represents a collection of rows. Rows implements sort.Interface.

type Tags

type Tags map[string]string

func (Tags) Copy added in v0.11.0

func (t Tags) Copy() Tags

Jump to

Keyboard shortcuts

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