query

package
v3.7.2 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2022 License: MIT Imports: 4 Imported by: 5

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.

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.

func (*Request) UnmarshalJSON added in v3.1.0

func (r *Request) UnmarshalJSON(b []byte) (err error)

UnmarshalJSON unmarshalls a Request from JSON

type Response

type Response interface {
	MarshalJSON() ([]byte, error)
}

Response interface for timeseries and table responses

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 (t TableResponse) MarshalJSON() (output []byte, err error)

MarshalJSON converts a TableResponse to JSON.

type Target

type Target struct {
	Name 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
	DataPoints []DataPoint
}

TimeSeriesResponse is the response from a timeseries Query.

func (TimeSeriesResponse) MarshalJSON

func (t TimeSeriesResponse) MarshalJSON() (output []byte, err error)

MarshalJSON converts a TimeSeriesResponse to JSON.

Jump to

Keyboard shortcuts

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