summaryrefslogtreecommitdiff
path: root/funcs.go
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2017-08-05 13:21:05 -0400
committerDave Henderson <dhenderson@gmail.com>2017-08-09 21:51:07 -0400
commit51ddb6e800ab087fa3dff19686b0f1f39a1a4432 (patch)
tree1892e841efa720c2cc387cd0de7f9c1b6d318c63 /funcs.go
parentdd5a7e412352f2e268973b428648cca6e549dc83 (diff)
Extracting data namespace, renaming typeconv to conv namespace
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'funcs.go')
-rw-r--r--funcs.go33
1 files changed, 5 insertions, 28 deletions
diff --git a/funcs.go b/funcs.go
index aa98f029..f4a5d6fc 100644
--- a/funcs.go
+++ b/funcs.go
@@ -1,45 +1,22 @@
package main
import (
- "net/url"
"text/template"
+ "github.com/hairyhenderson/gomplate/data"
"github.com/hairyhenderson/gomplate/funcs"
)
// initFuncs - The function mappings are defined here!
-func initFuncs(data *Data) template.FuncMap {
- typeconv := &TypeConv{}
-
- f := template.FuncMap{
- "bool": typeconv.Bool,
- "has": typeconv.Has,
- "json": typeconv.JSON,
- "jsonArray": typeconv.JSONArray,
- "yaml": typeconv.YAML,
- "yamlArray": typeconv.YAMLArray,
- "toml": typeconv.TOML,
- "csv": typeconv.CSV,
- "csvByRow": typeconv.CSVByRow,
- "csvByColumn": typeconv.CSVByColumn,
- "slice": typeconv.Slice,
- "join": typeconv.Join,
- "toJSON": typeconv.ToJSON,
- "toJSONPretty": typeconv.toJSONPretty,
- "toYAML": typeconv.ToYAML,
- "toTOML": typeconv.ToTOML,
- "toCSV": typeconv.ToCSV,
- "urlParse": url.Parse,
- "datasource": data.Datasource,
- "ds": data.Datasource,
- "datasourceExists": data.DatasourceExists,
- "include": data.include,
- }
+func initFuncs(d *data.Data) template.FuncMap {
+ f := template.FuncMap{}
+ funcs.AddDataFuncs(f, d)
funcs.AWSFuncs(f)
funcs.AddBase64Funcs(f)
funcs.AddNetFuncs(f)
funcs.AddReFuncs(f)
funcs.AddStringFuncs(f)
funcs.AddEnvFuncs(f)
+ funcs.AddConvFuncs(f)
return f
}