结构体中mapstructure含义
来源:1-5 为grpc服务添加viper和zap
qq_孤海_0
2024-07-30 14:06:09
结构体tag中mapstructure是做什么的?什么场景下使用
mapstructur
1回答
首思
2024-08-18
用于对应配置文件的
host: '127.0.0.1'
这个host对应 mapstructure的host
json
mapstructure
map
mapstructure库主要用于将map(通常是map[string]interface{})解码为Go的结构体类型,类似于json库用于将JSON数据解码为Go结构体。在使用mapstructure时,你可以通过结构体字段上的mapstructure标签来指定映射规则
map[string]interface{}
Go开发工程师
508 学习 · 577 问题
相似问题
回答 1
回答 2