当前位置:网站首页>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)
}边栏推荐
- 【框架】idea找不到xxx依赖项怎么办
- TiFlash 计算层概览
- [OpenCV] Book view correction + advertising screen switching Perspective transformation image processing
- VLAN 实验
- 【OpenCV】 级联分类器训练模型
- Zhang Le: The Golden Triangle of R&D Efficiency and Practice in the Field of Demand and Agile Collaboration|Live Review
- 工具模板 | 用APOEM方法消除对用户行为的偏见
- petri网-1、概论
- HCIP Day 16 Notes (SVI, Spanning Tree Protocol)
- MySQL数据表操作实战
猜你喜欢

GameFi industry down but not out | June Report

Forrester:行业云帮助中国企业更快适应未来的发展

OpenHarmony高校技术俱乐部计划发布

网易互娱在秒级监控、服务限流、AIOps落地上的运维升级实践

An introduction to the pen tool, pencil tool and brush tool

使用Typora+EasyBlogImageForTypora写博客,无图床快速上传图片

js单线程及事件循环、宏任务和微任务

An animation optimization of shape tween and optimization of traditional tweening

Nature, Cell都在用的Relia Tech 抗原亲和纯化LYVE1抗体

STL——vector
随机推荐
金立前高管团队再战手机市场,创立新品牌“FreeYond”
QImageReader
Forrester:行业云帮助中国企业更快适应未来的发展
爱可可AI前沿推介(8.3)
力扣刷题 每日两题(一)
DAY19(DAY20、DAY21拓展):SQL 注入
参数量仅0.5B,谷歌代码补全新方法将内部生产效率提升6%
Left index of all anagrams in leetcode/string (some permutation of s1 string is a substring of s2)
Jmeter use
[Microservice] Multi-level cache
d写二进制
leetcode/字符串中的所有变位词(s1字符串的某个排列是s2的子串)的左索引
软件测试考证:ISTQB、软件评测师
安全狗《云原生安全威胁分析报告》首次提出双检测模型
Hanyuan Hi-Tech G8032 standard ERPS ring network switch Gigabit 4 optical 10 electrical industrial Ethernet switch ring network + WEB management + SNMP VLAN planning
驻尼日利亚使馆发布阿布贾祖玛岩附近地区紧急安全预警
《深度学习》-学习笔记-1-机器学习基础
d作者:d的新特性
背后的力量 | 提升医疗服务“速度“和“温度” 华云数据助力上海国际医学中心加速智慧医院建设
IDO代币预售dapp开发及NFT模式