go map转struct【mapstructure库】
package mainimport ("fmt""githubmitchellhmapstructure")type Cat struct {Namestring mapstructure
5天前60
package mainimport ("fmt""githubmitchellhmapstructure")type Cat struct {Namestring mapstructure
mapstructure的作用是把map[string]interface{}类型的数据根据结构体字段的名称或名称后的注解与“string”进行对应,生成struct对象,大小写不敏感。viper