Commit 24a3a100 by bergquist

feat(influxdb): add alias to query

parent 029e52f5
...@@ -13,6 +13,7 @@ func (qp *InfluxdbQueryParser) Parse(model *simplejson.Json, dsInfo *tsdb.DataSo ...@@ -13,6 +13,7 @@ func (qp *InfluxdbQueryParser) Parse(model *simplejson.Json, dsInfo *tsdb.DataSo
policy := model.Get("policy").MustString("default") policy := model.Get("policy").MustString("default")
rawQuery := model.Get("query").MustString("") rawQuery := model.Get("query").MustString("")
interval := model.Get("interval").MustString("") interval := model.Get("interval").MustString("")
alias := model.Get("alias").MustString("")
measurement := model.Get("measurement").MustString("") measurement := model.Get("measurement").MustString("")
...@@ -52,6 +53,7 @@ func (qp *InfluxdbQueryParser) Parse(model *simplejson.Json, dsInfo *tsdb.DataSo ...@@ -52,6 +53,7 @@ func (qp *InfluxdbQueryParser) Parse(model *simplejson.Json, dsInfo *tsdb.DataSo
Selects: selects, Selects: selects,
RawQuery: rawQuery, RawQuery: rawQuery,
Interval: interval, Interval: interval,
Alias: alias,
}, nil }, nil
} }
......
...@@ -90,6 +90,7 @@ func TestInfluxdbQueryParser(t *testing.T) { ...@@ -90,6 +90,7 @@ func TestInfluxdbQueryParser(t *testing.T) {
} }
] ]
], ],
"alias": "serie alias",
"tags": [ "tags": [
{ {
"key": "datacenter", "key": "datacenter",
...@@ -115,6 +116,7 @@ func TestInfluxdbQueryParser(t *testing.T) { ...@@ -115,6 +116,7 @@ func TestInfluxdbQueryParser(t *testing.T) {
So(len(res.Selects), ShouldEqual, 3) So(len(res.Selects), ShouldEqual, 3)
So(len(res.Tags), ShouldEqual, 2) So(len(res.Tags), ShouldEqual, 2)
So(res.Interval, ShouldEqual, ">20s") So(res.Interval, ShouldEqual, ">20s")
So(res.Alias, ShouldEqual, "serie alias")
}) })
Convey("can part raw query json model", func() { Convey("can part raw query json model", func() {
......
...@@ -8,6 +8,7 @@ type Query struct { ...@@ -8,6 +8,7 @@ type Query struct {
GroupBy []*QueryPart GroupBy []*QueryPart
Selects []*Select Selects []*Select
RawQuery string RawQuery string
Alias string
Interval string Interval string
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment