报价单接近完成
This commit is contained in:
20
utils/format/template.go
Normal file
20
utils/format/template.go
Normal file
@@ -0,0 +1,20 @@
|
||||
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
|
||||
},
|
||||
}
|
||||
Reference in New Issue
Block a user