pass Query to MacroEngine Interpolate

This commit is contained in:
Sven Klemm
2017-12-08 23:04:17 +01:00
parent 0506cfdc1d
commit b6df91d56b
5 changed files with 28 additions and 24 deletions

View File

@ -15,14 +15,16 @@ const sExpr = `\$` + rsIdentifier + `\(([^\)]*)\)`
type PostgresMacroEngine struct {
TimeRange *tsdb.TimeRange
Query *tsdb.Query
}
func NewPostgresMacroEngine() tsdb.SqlMacroEngine {
return &PostgresMacroEngine{}
}
func (m *PostgresMacroEngine) Interpolate(timeRange *tsdb.TimeRange, sql string) (string, error) {
func (m *PostgresMacroEngine) Interpolate(query *tsdb.Query, timeRange *tsdb.TimeRange, sql string) (string, error) {
m.TimeRange = timeRange
m.Query = query
rExp, _ := regexp.Compile(sExpr)
var macroError error