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 ¶
- func SeriesToFrame(series DataTimeSeries) (*data.Frame, error)
- 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() (time.Time, error)
- func (tr DataTimeRange) ParseFromWithLocation(location *time.Location) (time.Time, error)
- func (tr DataTimeRange) ParseFromWithWeekStart(location *time.Location, weekstart time.Weekday) (time.Time, error)
- func (tr DataTimeRange) ParseTo() (time.Time, error)
- func (tr DataTimeRange) ParseToWithLocation(location *time.Location) (time.Time, error)
- func (tr *DataTimeRange) ParseToWithWeekStart(location *time.Location, weekstart time.Weekday) (time.Time, error)
- type DataTimeSeries
- type DataTimeSeriesPoints
- type DataTimeSeriesSlice
- type RequestHandler
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SeriesToFrame ¶
func SeriesToFrame(series DataTimeSeries) (*data.Frame, error)
SeriesToFrame converts a DataTimeSeries to an SDK frame.
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.
func NewEncodedDataFrames ¶
func NewEncodedDataFrames(encodedFrames [][]byte) DataFrames
NewEncodedDataFrames instantiates DataFrames from encoded frames.
This one is primarily used for creating DataFrames when receiving encoded data frames from an external plugin or similar. This may allow the encoded data frames to be returned to Grafana UI without any additional decoding/encoding required. In Grafana alerting scenario it needs to operate on decoded data frames why encoded frames needs to be decoded before usage.
type DataQuery ¶
type DataQuery struct { TimeRange *DataTimeRange Queries []DataSubQuery Headers map[string]string Debug bool User *models.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
func (DataResponse) ToBackendDataResponse ¶
func (r DataResponse) ToBackendDataResponse() (*backend.QueryDataResponse, error)
ToBackendDataResponse converts the legacy format to the standard SDK format
type DataRowValues ¶
type DataRowValues []interface{}
type DataSubQuery ¶
type DataSubQuery struct { RefID string `json:"refId"` Model *simplejson.Json `json:"model,omitempty"` DataSource *models.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) ParseFromWithLocation ¶
func (DataTimeRange) ParseFromWithWeekStart ¶
func (DataTimeRange) ParseToWithLocation ¶
func (*DataTimeRange) ParseToWithWeekStart ¶
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, *models.DataSource, DataQuery) (DataResponse, error) }
RequestHandler is a data request handler interface. Deprecated: use backend.QueryDataHandler instead.