Add first & last helpers

This commit is contained in:
Mathieu Acthernoene 2016-12-15 12:22:23 +01:00
parent 3b5a2eeafe
commit 2ab581a1d6

View File

@ -29,6 +29,12 @@ var ProtoHelpersFuncMap = template.FuncMap{
a, _ := json.MarshalIndent(v, "", " ") a, _ := json.MarshalIndent(v, "", " ")
return string(a) return string(a)
}, },
"first": func(a []string) string {
return a[0]
},
"last": func(a []string) string {
return a[len(a)-1]
},
} }
type GenericTemplateBasedEncoder struct { type GenericTemplateBasedEncoder struct {