fusenapi/utils/format/template.go
2023-06-27 18:09:56 +08:00

21 lines
334 B
Go

package format
import (
"encoding/json"
"text/template"
)
var TemplateFuncMap = template.FuncMap{
"add": func(a, b int) int {
return a + b
},
"json_decode": func(o interface{}) interface{} {
var r []map[string]interface{}
err := json.Unmarshal([]byte(o.(string)), &r)
if err != nil {
panic(err)
}
return r
},
}