Commit 4d8d2a96 by Ander Arguiñano

Renamed unixEpochFilterNano to unixEpochNanoFilter

parent 1a67a8db
...@@ -122,7 +122,7 @@ func (m *postgresMacroEngine) evaluateMacro(name string, args []string) (string, ...@@ -122,7 +122,7 @@ func (m *postgresMacroEngine) evaluateMacro(name string, args []string) (string,
return "", fmt.Errorf("missing time column argument for macro %v", name) return "", fmt.Errorf("missing time column argument for macro %v", name)
} }
return fmt.Sprintf("%s >= %d AND %s <= %d", args[0], m.timeRange.GetFromAsSecondsEpoch(), args[0], m.timeRange.GetToAsSecondsEpoch()), nil return fmt.Sprintf("%s >= %d AND %s <= %d", args[0], m.timeRange.GetFromAsSecondsEpoch(), args[0], m.timeRange.GetToAsSecondsEpoch()), nil
case "__unixEpochFilterNano": case "__unixEpochNanoFilter":
if len(args) == 0 { if len(args) == 0 {
return "", fmt.Errorf("missing time column argument for macro %v", name) return "", fmt.Errorf("missing time column argument for macro %v", name)
} }
......
...@@ -115,8 +115,8 @@ func TestMacroEngine(t *testing.T) { ...@@ -115,8 +115,8 @@ func TestMacroEngine(t *testing.T) {
So(sql, ShouldEqual, fmt.Sprintf("select time >= %d AND time <= %d", from.Unix(), to.Unix())) So(sql, ShouldEqual, fmt.Sprintf("select time >= %d AND time <= %d", from.Unix(), to.Unix()))
}) })
Convey("interpolate __unixEpochFilterNano function", func() { Convey("interpolate __unixEpochNanoFilter function", func() {
sql, err := engine.Interpolate(query, timeRange, "select $__unixEpochFilterNano(time)") sql, err := engine.Interpolate(query, timeRange, "select $__unixEpochNanoFilter(time)")
So(err, ShouldBeNil) So(err, ShouldBeNil)
So(sql, ShouldEqual, fmt.Sprintf("select time >= %d AND time <= %d", from.UnixNano(), to.UnixNano())) So(sql, ShouldEqual, fmt.Sprintf("select time >= %d AND time <= %d", from.UnixNano(), to.UnixNano()))
...@@ -153,8 +153,8 @@ func TestMacroEngine(t *testing.T) { ...@@ -153,8 +153,8 @@ func TestMacroEngine(t *testing.T) {
So(sql, ShouldEqual, fmt.Sprintf("select time >= %d AND time <= %d", from.Unix(), to.Unix())) So(sql, ShouldEqual, fmt.Sprintf("select time >= %d AND time <= %d", from.Unix(), to.Unix()))
}) })
Convey("interpolate __unixEpochFilterNano function", func() { Convey("interpolate __unixEpochNanoFilter function", func() {
sql, err := engine.Interpolate(query, timeRange, "select $__unixEpochFilterNano(time)") sql, err := engine.Interpolate(query, timeRange, "select $__unixEpochNanoFilter(time)")
So(err, ShouldBeNil) So(err, ShouldBeNil)
So(sql, ShouldEqual, fmt.Sprintf("select time >= %d AND time <= %d", from.UnixNano(), to.UnixNano())) So(sql, ShouldEqual, fmt.Sprintf("select time >= %d AND time <= %d", from.UnixNano(), to.UnixNano()))
...@@ -179,8 +179,8 @@ func TestMacroEngine(t *testing.T) { ...@@ -179,8 +179,8 @@ func TestMacroEngine(t *testing.T) {
So(sql, ShouldEqual, fmt.Sprintf("select time >= %d AND time <= %d", from.Unix(), to.Unix())) So(sql, ShouldEqual, fmt.Sprintf("select time >= %d AND time <= %d", from.Unix(), to.Unix()))
}) })
Convey("interpolate __unixEpochFilterNano function", func() { Convey("interpolate __unixEpochNanoFilter function", func() {
sql, err := engine.Interpolate(query, timeRange, "select $__unixEpochFilterNano(time)") sql, err := engine.Interpolate(query, timeRange, "select $__unixEpochNanoFilter(time)")
So(err, ShouldBeNil) So(err, ShouldBeNil)
So(sql, ShouldEqual, fmt.Sprintf("select time >= %d AND time <= %d", from.UnixNano(), to.UnixNano())) So(sql, ShouldEqual, fmt.Sprintf("select time >= %d AND time <= %d", from.UnixNano(), to.UnixNano()))
......
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