forked from hairyhenderson/gomplate
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathfuncs.go
37 lines (33 loc) · 1.05 KB
/
funcs.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
31
32
33
34
35
36
37
package gomplate
import (
"context"
"text/template"
"github.com/flanksource/gomplate/v3/funcs" //nolint:staticcheck
)
// CreateFuncs - function mappings are created here
func CreateFuncs(ctx context.Context) template.FuncMap {
f := template.FuncMap{}
addToMap(f, funcs.CreateDataFuncs(ctx))
addToMap(f, funcs.CreateBase64Funcs(ctx))
addToMap(f, funcs.CreateReFuncs(ctx))
addToMap(f, funcs.CreateStringFuncs(ctx))
addToMap(f, funcs.CreateConvFuncs(ctx))
addToMap(f, funcs.CreateTimeFuncs(ctx))
addToMap(f, funcs.CreateMathFuncs(ctx))
addToMap(f, funcs.CreateCryptoFuncs(ctx))
addToMap(f, funcs.CreateKubernetesFuncs(ctx))
addToMap(f, funcs.CreateFilePathFuncs(ctx))
addToMap(f, funcs.CreatePathFuncs(ctx))
addToMap(f, funcs.CreateTestFuncs(ctx))
addToMap(f, funcs.CreateCollFuncs(ctx))
addToMap(f, funcs.CreateUUIDFuncs(ctx))
addToMap(f, funcs.CreateRandomFuncs(ctx))
addToMap(f, funcs.CreateEncodeFuncs(ctx))
return f
}
// addToMap - add src's entries to dst
func addToMap(dst, src map[string]interface{}) {
for k, v := range src {
dst[k] = v
}
}