protoc-gen-go-micro/vendor/github.com/moul/funcmap/funcmap.go
Manfred Touron c8c607ae0d
Add vendor
2016-11-06 18:32:32 +01:00

27 lines
458 B
Go

package funcmap
import (
"encoding/json"
"strings"
"text/template"
)
var FuncMap = template.FuncMap{
"json": func(v interface{}) string {
a, _ := json.Marshal(v)
return string(a)
},
"prettyjson": func(v interface{}) string {
a, _ := json.MarshalIndent(v, "", " ")
return string(a)
},
// yaml
// xml
// toml
"split": strings.Split,
"join": strings.Join,
"title": strings.Title,
"lower": strings.ToLower,
"upper": strings.ToUpper,
}