query

package
v2.0.0 Latest Latest
Warning

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

Go to latest
Published: Jan 23, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Args

type Args struct {
	common.Args
	// Interval      QueryRequestDuration `json:"interval"`
	MaxDataPoints uint64 `json:"maxDataPoints"`
}

Args contains the arguments for a Query.

type Column

type Column struct {
	Text string
	Data interface{}
}

Column is a column returned by a TableQuery. Text holds the column's header, Data holds the slice of values and should be a TimeColumn, a StringColumn or a NumberColumn.

type DataPoint

type DataPoint struct {
	Timestamp time.Time
	Value     int64
}

DataPoint contains one entry returned by a Query.

func (*DataPoint) MarshalJSON

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

MarshalJSON converts a DataPoint to JSON.

func (*DataPoint) UnmarshalJSON

func (d *DataPoint) UnmarshalJSON(input []byte) (err error)

UnmarshalJSON converts a JSON structure to a DataPoint.

type NumberColumn

type NumberColumn []float64

NumberColumn holds a slice of number values (one per row).

type Request

type Request struct {
	Targets []Target `json:"targets"`
	Args
}

Request is a Query request. For each specified Target, the server will call the appropriate handler's Query or TableQuery function with the provided Args.

type StringColumn

type StringColumn []string

StringColumn holds a slice of string values (one per row).

type TableResponse

type TableResponse struct {
	Columns []Column
}

TableResponse is returned by a TableQuery, i.e. a slice of Column structures.

func (*TableResponse) MarshalJSON

func (table *TableResponse) MarshalJSON() (output []byte, err error)

MarshalJSON converts a TableResponse to JSON.

type Target

type Target struct {
	Target string `json:"target"` // name of the target.
	Type   string `json:"type"`   // "timeserie" or "" for timeseries. "table" for table queries.
}

Target specifies the requested target name and type.

type TimeColumn

type TimeColumn []time.Time

TimeColumn holds a slice of time.Time values (one per row).

type TimeSeriesResponse

type TimeSeriesResponse struct {
	Target     string      `json:"target"`     // name of the target
	DataPoints []DataPoint `json:"datapoints"` // values for the target
}

TimeSeriesResponse is the response from a timeseries Query.

Jump to

Keyboard shortcuts

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