go-zero/example/config/loadfromyaml/main.go

22 lines
269 B
Go
Raw Normal View History

2020-07-26 17:09:05 +08:00
package main
import (
"time"
"zero/core/conf"
"zero/core/logx"
)
type TimeHolder struct {
Date time.Time `json:"date"`
}
func main() {
th := &TimeHolder{}
err := conf.LoadConfig("./date.yml", th)
if err != nil {
logx.Error(err)
}
logx.Infof("%+v", th)
}