grafana/pkg/tsdb/influxdb/models.go
Joey Tawadrous 10232c7857
InfluxDB: backend migration (run query in explore) (#43352)
* InfluxDB backend migration

* Multiple queries and more

* Added types

* Updated preferredVisualisationType

* Updated model parser test to include limit,slimit,orderByTime

* Added test for building query with limit, slimit

* Added test for building query with limit, slimit, orderByTime and puts them in the correct order

* Add test: Influxdb response parser should parse two responses with different refIDs

* Moved methods to responds parser

* Add test to ensure ExecutedQueryString is populated

* Move functions out of response parser class

* Test for getSelectedParams

* Merge cases

* Change to const

* Test get table columns correctly

* Removed unecessary fields

* Test get table rows correctly

* Removed getSeries function

* Added test for preferredVisualisationType

* Added test for executedQueryString

* Modified response parser

* Removed test

* Improvements

* Tests

* Review changes

* Feature flag rename and code gen
2022-02-09 18:26:16 +00:00

53 lines
937 B
Go

package influxdb
import "time"
type Query struct {
Measurement string
Policy string
Tags []*Tag
GroupBy []*QueryPart
Selects []*Select
RawQuery string
UseRawQuery bool
Alias string
Interval time.Duration
Tz string
Limit string
Slimit string
OrderByTime string
RefID string
}
type Tag struct {
Key string
Operator string
Value string
Condition string
}
type Select []QueryPart
type Response struct {
Results []Result
Error string
}
type Result struct {
Series []Row
Messages []*Message
Error string
}
type Message struct {
Level string `json:"level,omitempty"`
Text string `json:"text,omitempty"`
}
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"`
}