当前位置:网站首页>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)
}
边栏推荐
猜你喜欢
[微服务]多级缓存
W11或W10系统如何进行休眠?
Jmeter use
升级农企业务运营建设,智慧供应链管理平台打造“共赢生态链”
Zhang Le: The Golden Triangle of R&D Efficiency and Practice in the Field of Demand and Agile Collaboration|Live Review
苹果终于认清现实,销量成为优先考虑,iPhone14将不涨价
Graphic animation and button animation of an animation basic component
细胞图像数据的主动学习
An introduction to the width tool, deformation tool and lasso tool
数字孪生的4个最佳实践
随机推荐
An introduction to the camera
[Deep Learning] Overview of Efficient and Lightweight Semantic Segmentation
Jmeter use
[微服务]多级缓存
标题 node第一个服务器程序
【深度学习中的激活函数的整理与使用总结】
PyTorch builds a neural network to predict temperature (dataset comparison, CPU vs GPU comparison)
【OpenCV】 书本视图矫正 + 广告屏幕切换 透视变换图像处理
不卷不pua,早9晚6,这个招聘深得我心
secureCRT连接开发板连接不上问题解决
PyTorch builds a classification network model (Mnist dataset, fully connected neural network)
华云数据张华林:投身数字蓝海 绘就云上强国
[R] Use grafify for statistical plotting, ANOVA, intervention comparisons, and more!
使用百度EasyDL实现施工人员安全装备检测
TiFlash 计算层概览
【OpenCV】 级联分类器训练模型
农产品企业如何进行全网营销?
冷链行业商业供应链系统:实现全流程数字化协同,激活企业迸发市场活力
安全狗《云原生安全威胁分析报告》首次提出双检测模型
petri网-1、概论