viper-template:Golang Viper库的扩展,以在viper配置中使用Go模板

时间:2021-04-08 00:10:31
【文件属性】:
文件名称:viper-template:Golang Viper库的扩展,以在viper配置中使用Go模板
文件大小:21KB
文件格式:ZIP
更新时间:2021-04-08 00:10:31
Go 毒蛇模板 Golang Viper库的扩展,以在viper配置中使用Go模板 用法 package main import ( "fmt" "text/template" "github.com/spf13/viper" vipertemplate "github.com/sv-tools/viper-template" ) func main () { v := viper . New () v . Set ( "foo" , `{{ Get "bar" }}` ) v . Set ( "bar" , `{{ Mul . 2 }}` ) type Data struct { Bar int } data := Data { Bar : 42 , } funcs := template. FuncMap { "Mul" : func ( d * Data
【文件预览】:
viper-template-main
----.nancy-ignore(60B)
----parser.go(1KB)
----options_test.go(1KB)
----buffers.go(281B)
----.github()
--------dependabot.yml(199B)
--------workflows()
----options.go(702B)
----errors.go(459B)
----LICENSE(1KB)
----viperTemplate.go(757B)
----.gitignore(269B)
----.codecov.yml(14B)
----.golangci.yml(1KB)
----go.sum(29KB)
----viperTemplate_test.go(3KB)
----README.md(1KB)
----go.mod(131B)

网友评论