@@ -30,25 +30,25 @@ type SQLTemplate struct {
30
30
// This func should return current time.
31
31
// If this function is not set, used `time.Now()` as default function.
32
32
TimeFunc func () time.Time
33
- // CustomFuncs are custom functions that are used in template.
34
- CustomFuncs map [string ]interface {}
33
+ // customFuncs are custom functions that are used in template.
34
+ customFuncs map [string ]interface {}
35
35
}
36
36
37
37
// New template initialized with dialect.
38
38
func New (dialect Dialect ) SQLTemplate {
39
- return SQLTemplate {dialect : dialect , CustomFuncs : make (map [string ]interface {})}
39
+ return SQLTemplate {dialect : dialect , customFuncs : make (map [string ]interface {})}
40
40
}
41
41
42
42
// AddFunc add custom template func.
43
43
func (st SQLTemplate ) AddFunc (name string , fn interface {}) SQLTemplate {
44
- st .CustomFuncs [name ] = fn
44
+ st .customFuncs [name ] = fn
45
45
return st
46
46
}
47
47
48
48
// AddFuncs add custom template functions.
49
49
func (st SQLTemplate ) AddFuncs (funcs map [string ]interface {}) SQLTemplate {
50
50
for k , v := range funcs {
51
- st .CustomFuncs [k ] = v
51
+ st .customFuncs [k ] = v
52
52
}
53
53
return st
54
54
}
@@ -76,7 +76,7 @@ func (st SQLTemplate) ExecNamed(text string, m map[string]interface{}) (string,
76
76
}
77
77
78
78
func (st SQLTemplate ) exec (c * context , text string , m map [string ]interface {}) (string , error ) {
79
- t , err := template .New ("" ).Funcs (c .funcMap (st .CustomFuncs )).Delims (LeftDelim , RightDelim ).Parse (dropSample (text ))
79
+ t , err := template .New ("" ).Funcs (c .funcMap (st .customFuncs )).Delims (LeftDelim , RightDelim ).Parse (dropSample (text ))
80
80
if err != nil {
81
81
return "" , err
82
82
}
0 commit comments