summaryrefslogtreecommitdiff
path: root/funcs.go
diff options
context:
space:
mode:
authorDave Henderson <dhenderson@gmail.com>2017-06-08 20:41:41 -0400
committerDave Henderson <dhenderson@gmail.com>2017-06-08 20:41:41 -0400
commitb580bba092120362867f37a5a691dc8a1fd00d7c (patch)
tree3ee722f234107f7a2d5a1054f991ecae0d7d06af /funcs.go
parent3837f4874bf8f690bc97d8f83a957804c7ce6783 (diff)
Namespacing the AWS funcs
Signed-off-by: Dave Henderson <dhenderson@gmail.com>
Diffstat (limited to 'funcs.go')
-rw-r--r--funcs.go56
1 files changed, 56 insertions, 0 deletions
diff --git a/funcs.go b/funcs.go
new file mode 100644
index 00000000..ac790090
--- /dev/null
+++ b/funcs.go
@@ -0,0 +1,56 @@
+package main
+
+import (
+ "net/url"
+ "strings"
+ "text/template"
+
+ "github.com/hairyhenderson/gomplate/funcs"
+)
+
+// initFuncs - The function mappings are defined here!
+func initFuncs(data *Data) template.FuncMap {
+ env := &Env{}
+ typeconv := &TypeConv{}
+ stringfunc := &stringFunc{}
+
+ f := template.FuncMap{
+ "getenv": env.Getenv,
+ "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,
+ "indent": typeconv.indent,
+ "join": typeconv.Join,
+ "toJSON": typeconv.ToJSON,
+ "toJSONPretty": typeconv.toJSONPretty,
+ "toYAML": typeconv.ToYAML,
+ "toTOML": typeconv.ToTOML,
+ "toCSV": typeconv.ToCSV,
+ "contains": strings.Contains,
+ "hasPrefix": strings.HasPrefix,
+ "hasSuffix": strings.HasSuffix,
+ "replaceAll": stringfunc.replaceAll,
+ "split": strings.Split,
+ "splitN": strings.SplitN,
+ "title": strings.Title,
+ "toUpper": strings.ToUpper,
+ "toLower": strings.ToLower,
+ "trim": strings.Trim,
+ "trimSpace": strings.TrimSpace,
+ "urlParse": url.Parse,
+ "datasource": data.Datasource,
+ "ds": data.Datasource,
+ "datasourceExists": data.DatasourceExists,
+ "include": data.include,
+ }
+ funcs.AWSFuncs(f)
+ return f
+}