当前位置:网站首页>go map转struct【mapstructure库】
go map转struct【mapstructure库】
2022-08-03 13:37:00 【给我一瓶冰阔洛】
package main
import (
"fmt"
"github.com/mitchellh/mapstructure"
)
type Cat struct {
Name string `mapstructure:"a"`
Breed string `mapstructure:"b"`
}
func main() {
m := map[string]string{
"a":"aaa",
"b":"bbb",
}
var c Cat
mapstructure.Decode(m, &c)
fmt.Println(c)
}
边栏推荐
- [Deep Learning] Overview of Efficient and Lightweight Semantic Segmentation
- 厨卫电器行业数字化集采管理系统:优化产业供应结构,实现采购业务流程集中管控
- js \n\r 换行失败 :【white-space: pre-line;】${} Template Literals
- Nanoprobes FluoroNanogold 偶联物的特色和应用
- MySQL数据表操作实战
- HCIP第十五天笔记(企业网的三层架构、VLAN以及VLAN 的配置)
- Petri网-2、有向网
- 张乐:研发效能的黄金三角及需求与敏捷协作领域的实践|直播回顾
- PCL 点云按时间进行分段
- 设计思维 | 详看设计工作坊Workshop的11个关键技巧
猜你喜欢
An introduction to the width tool, deformation tool and lasso tool
scala安装包
【web渗透】CSRF漏洞详细讲解
Forrester:行业云帮助中国企业更快适应未来的发展
升级农企业务运营建设,智慧供应链管理平台打造“共赢生态链”
设计思维 | 详看设计工作坊Workshop的11个关键技巧
【OpenCV】 级联分类器训练模型
An animation optimization of traditional guide layer animation
An introduction to the camera
TensorFlow离线安装包
随机推荐
不卷不pua,早9晚6,这个招聘深得我心
数据分析(二)——numpy
HCIP 第十六天笔记(SVI、生成树协议)
Golang GMP 原理
An animation based button animation combined with basic code
Golang 接口 interface
An animation optimization of shape tween and optimization of traditional tweening
15 years of software architect experience summary: In the ML field, 5 pits that beginners have stepped on
An introduction to the pen tool, pencil tool and brush tool
d write binary
PyTorch framework to train linear regression model (CPU and GPU environment)
函数在结构体中的应用练习
第07章 InnoDB数据存储结构【2.索引及调优篇】【MySQL高级】
[Microservice] Multi-level cache
鸿湖万联扬帆富设备开发板正式合入OpenHarmony主干
[OpenCV] Cascade classifier training model
d写二进制
The maximum number of sliding window
js \n\r 换行失败 :【white-space: pre-line;】${} Template Literals
半导体制造业回流美国?宏碁创始人施振荣:违反垂直分工大趋势