-
Notifications
You must be signed in to change notification settings - Fork 13
/
Copy pathmacros.go
30 lines (24 loc) · 1.01 KB
/
macros.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
package sqlds
import (
"errors"
"github.com/grafana/grafana-plugin-sdk-go/data/sqlutil"
)
var (
// ErrorBadArgumentCount is returned from macros when the wrong number of arguments were provided
ErrorBadArgumentCount = errors.New("unexpected number of arguments")
)
// MacroFunc defines a signature for applying a query macro
// Query macro implementations are defined by users / consumers of this package
// Deprecated: use sqlutil.MacroFunc directly
type MacroFunc = sqlutil.MacroFunc
// Macros is a list of MacroFuncs.
// The "string" key is the name of the macro function. This name has to be regex friendly.
// Deprecated: use sqlutil.Macros directly
type Macros = sqlutil.Macros
// Deprecated: use sqlutil.DefaultMacros directly
var DefaultMacros = sqlutil.DefaultMacros
// Interpolate wraps sqlutil.Interpolate for temporary backwards-compatibility
// Deprecated: use sqlutil.Interpolate directly
func Interpolate(driver Driver, query *Query) (string, error) {
return sqlutil.Interpolate(query, driver.Macros())
}