Commit bf4ee9bc by bergquist

influxdb: adds mode func to backend

closes #12286
parent 56628996
...@@ -31,6 +31,7 @@ func init() { ...@@ -31,6 +31,7 @@ func init() {
renders["mean"] = QueryDefinition{Renderer: functionRenderer} renders["mean"] = QueryDefinition{Renderer: functionRenderer}
renders["median"] = QueryDefinition{Renderer: functionRenderer} renders["median"] = QueryDefinition{Renderer: functionRenderer}
renders["sum"] = QueryDefinition{Renderer: functionRenderer} renders["sum"] = QueryDefinition{Renderer: functionRenderer}
renders["mode"] = QueryDefinition{Renderer: functionRenderer}
renders["holt_winters"] = QueryDefinition{ renders["holt_winters"] = QueryDefinition{
Renderer: functionRenderer, Renderer: functionRenderer,
......
...@@ -84,5 +84,13 @@ func TestInfluxdbQueryPart(t *testing.T) { ...@@ -84,5 +84,13 @@ func TestInfluxdbQueryPart(t *testing.T) {
res := part.Render(query, queryContext, "distinct(value)") res := part.Render(query, queryContext, "distinct(value)")
So(res, ShouldEqual, `count(distinct(value))`) So(res, ShouldEqual, `count(distinct(value))`)
}) })
Convey("render mode", func() {
part, err := NewQueryPart("mode", []string{})
So(err, ShouldBeNil)
res := part.Render(query, queryContext, "value")
So(res, ShouldEqual, `mode(value)`)
})
}) })
} }
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