Documentation ¶
Overview ¶
Package legacydata contains old/legacy interfaces/contracts that uses a data format of series/tables. Deprecated: use github.com/grafana/grafana-plugin-sdk-go/backend instead.
Index ¶
- type DataFrames
- type DataQuery
- type DataQueryResultdeprecated
- type DataResponsedeprecated
- type DataRowValues
- type DataSubQuery
- type DataTable
- type DataTableColumn
- type DataTimePoint
- type DataTimeRange
- func (tr DataTimeRange) GetFromAsMsEpoch() int64
- func (tr DataTimeRange) GetFromAsSecondsEpoch() int64
- func (tr DataTimeRange) GetFromAsTimeUTC() time.Time
- func (tr DataTimeRange) GetToAsMsEpoch() int64
- func (tr DataTimeRange) GetToAsSecondsEpoch() int64
- func (tr DataTimeRange) GetToAsTimeUTC() time.Time
- func (tr DataTimeRange) MustGetFrom() time.Time
- func (tr DataTimeRange) MustGetTo() time.Time
- func (tr DataTimeRange) ParseFrom(options ...TimeRangeOption) (time.Time, error)
- func (tr DataTimeRange) ParseTo(options ...TimeRangeOption) (time.Time, error)
- type DataTimeSeries
- type DataTimeSeriesPoints
- type DataTimeSeriesSlice
- type RequestHandler
- type TimeRangeOption
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DataFrames ¶
type DataFrames interface { // Encoded encodes Frames into a slice of []byte. // If an error occurs [][]byte will be nil. // The encoded result, if any, will be cached and returned next time Encoded is called. Encoded() ([][]byte, error) // Decoded decodes a slice of Arrow encoded frames to data.Frames ([]*data.Frame). // If an error occurs Frames will be nil. // The decoded result, if any, will be cached and returned next time Decoded is called. Decoded() (data.Frames, error) }
DataFrames is an interface for retrieving encoded and decoded data frames.
See NewDecodedDataFrames and NewEncodedDataFrames for more information.
func NewDecodedDataFrames ¶
func NewDecodedDataFrames(decodedFrames data.Frames) DataFrames
NewDecodedDataFrames instantiates DataFrames from decoded frames.
This should be the primary function for creating DataFrames if you're implementing a plugin. In a Grafana Alerting scenario it needs to operate on decoded frames, which is why this function is preferrable. When encoded data frames are needed, e.g. returned from Grafana HTTP API, it will happen automatically when MarshalJSON() is called.
type DataQuery ¶
type DataQuery struct { TimeRange *DataTimeRange Queries []DataSubQuery Headers map[string]string Debug bool User *user.SignedInUser }
DataQuery contains all information about a data query request. New work should use the plugin SDK.
type DataQueryResult
deprecated
type DataQueryResult struct { Error error `json:"-"` ErrorString string `json:"error,omitempty"` RefID string `json:"refId"` Meta *simplejson.Json `json:"meta,omitempty"` Series DataTimeSeriesSlice `json:"series"` Tables []DataTable `json:"tables"` Dataframes DataFrames `json:"dataframes"` }
Deprecated: DataQueryResult should use backend.QueryDataResponse
func (*DataQueryResult) UnmarshalJSON ¶
func (r *DataQueryResult) UnmarshalJSON(b []byte) error
UnmarshalJSON deserializes a DataQueryResult from JSON.
Deserialization support is required by tests.
type DataResponse
deprecated
type DataResponse struct { Results map[string]DataQueryResult `json:"results"` Message string `json:"message,omitempty"` }
Deprecated: DataResponse -- this structure is deprecated, all new work should use backend.QueryDataResponse
type DataRowValues ¶
type DataRowValues []interface{}
type DataSubQuery ¶
type DataSubQuery struct { RefID string `json:"refId"` Model *simplejson.Json `json:"model,omitempty"` DataSource *datasources.DataSource `json:"datasource"` MaxDataPoints int64 `json:"maxDataPoints"` IntervalMS int64 `json:"intervalMs"` QueryType string `json:"queryType"` }
DataSubQuery represents a data sub-query. New work should use the plugin SDK.
type DataTable ¶
type DataTable struct { Columns []DataTableColumn `json:"columns"` Rows []DataRowValues `json:"rows"` }
type DataTableColumn ¶
type DataTableColumn struct {
Text string `json:"text"`
}
type DataTimePoint ¶
type DataTimeRange ¶
func NewDataTimeRange ¶
func NewDataTimeRange(from, to string) DataTimeRange
func (DataTimeRange) GetFromAsMsEpoch ¶
func (tr DataTimeRange) GetFromAsMsEpoch() int64
func (DataTimeRange) GetFromAsSecondsEpoch ¶
func (tr DataTimeRange) GetFromAsSecondsEpoch() int64
func (DataTimeRange) GetFromAsTimeUTC ¶
func (tr DataTimeRange) GetFromAsTimeUTC() time.Time
func (DataTimeRange) GetToAsMsEpoch ¶
func (tr DataTimeRange) GetToAsMsEpoch() int64
func (DataTimeRange) GetToAsSecondsEpoch ¶
func (tr DataTimeRange) GetToAsSecondsEpoch() int64
func (DataTimeRange) GetToAsTimeUTC ¶
func (tr DataTimeRange) GetToAsTimeUTC() time.Time
func (DataTimeRange) MustGetFrom ¶
func (tr DataTimeRange) MustGetFrom() time.Time
func (DataTimeRange) MustGetTo ¶
func (tr DataTimeRange) MustGetTo() time.Time
func (DataTimeRange) ParseFrom ¶
func (tr DataTimeRange) ParseFrom(options ...TimeRangeOption) (time.Time, error)
func (DataTimeRange) ParseTo ¶
func (tr DataTimeRange) ParseTo(options ...TimeRangeOption) (time.Time, error)
type DataTimeSeries ¶
type DataTimeSeries struct { Name string `json:"name"` Points DataTimeSeriesPoints `json:"points"` Tags map[string]string `json:"tags,omitempty"` }
DataTimeSeries -- this structure is deprecated, all new work should use DataFrames from the SDK
type DataTimeSeriesPoints ¶
type DataTimeSeriesPoints []DataTimePoint
type DataTimeSeriesSlice ¶
type DataTimeSeriesSlice []DataTimeSeries
type RequestHandler ¶
type RequestHandler interface { // HandleRequest handles a data request. HandleRequest(context.Context, *datasources.DataSource, DataQuery) (DataResponse, error) }
RequestHandler is a data request handler interface. Deprecated: use backend.QueryDataHandler instead.
type TimeRangeOption ¶
type TimeRangeOption func(timeRange parsableTime) parsableTime
func WithFiscalStartMonth ¶
func WithFiscalStartMonth(month time.Month) TimeRangeOption
func WithLocation ¶
func WithLocation(loc *time.Location) TimeRangeOption
func WithNow ¶
func WithNow(t time.Time) TimeRangeOption
func WithRoundUp ¶
func WithRoundUp() TimeRangeOption
func WithWeekstart ¶
func WithWeekstart(weekday time.Weekday) TimeRangeOption