Add $__timeGroupAlias to postgres macros

This commit is contained in:
Sven Klemm
2018-08-01 08:48:22 +02:00
parent bd77541e09
commit 42f1892826
3 changed files with 25 additions and 12 deletions

View File

@ -110,6 +110,12 @@ func (m *postgresMacroEngine) evaluateMacro(name string, args []string) (string,
}
}
return fmt.Sprintf("floor(extract(epoch from %s)/%v)*%v", args[0], interval.Seconds(), interval.Seconds()), nil
case "__timeGroupAlias":
tg, err := m.evaluateMacro("__timeGroup", args)
if err == nil {
return tg + " AS \"time\"", err
}
return "", err
case "__unixEpochFilter":
if len(args) == 0 {
return "", fmt.Errorf("missing time column argument for macro %v", name)