diff --git a/app/setup.go b/app/setup.go index 234f368..73bada7 100644 --- a/app/setup.go +++ b/app/setup.go @@ -34,6 +34,14 @@ func SetupAndRunApp() error { // Add custom functions to the template engine engine.AddFunc("StringsJoin", strings.Join) + // Simple add function + engine.AddFunc( + "add", func(x, y int) int { + return x + y + }, + ) + + // Add possibility to send a map to the template engine.AddFunc("map", func(pairs ...any) (map[string]any, error) { if len(pairs)%2 != 0 { return nil, errors.New("misaligned map")