Skip to content

Commit 1177a2c

Browse files
committed
Hide custom funcs field to private
1 parent ecd3c48 commit 1177a2c

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

sqlt.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,25 +30,25 @@ type SQLTemplate struct {
3030
// This func should return current time.
3131
// If this function is not set, used `time.Now()` as default function.
3232
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{}
3535
}
3636

3737
// New template initialized with dialect.
3838
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{})}
4040
}
4141

4242
// AddFunc add custom template func.
4343
func (st SQLTemplate) AddFunc(name string, fn interface{}) SQLTemplate {
44-
st.CustomFuncs[name] = fn
44+
st.customFuncs[name] = fn
4545
return st
4646
}
4747

4848
// AddFuncs add custom template functions.
4949
func (st SQLTemplate) AddFuncs(funcs map[string]interface{}) SQLTemplate {
5050
for k, v := range funcs {
51-
st.CustomFuncs[k] = v
51+
st.customFuncs[k] = v
5252
}
5353
return st
5454
}
@@ -76,7 +76,7 @@ func (st SQLTemplate) ExecNamed(text string, m map[string]interface{}) (string,
7676
}
7777

7878
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))
8080
if err != nil {
8181
return "", err
8282
}

0 commit comments

Comments
 (0)