当前位置:网站首页>golang 修改 结构体切片的值
golang 修改 结构体切片的值
2022-06-29 06:38:00 【我林】
// 补全产品信息, 产品名,产品价格
var mallGoods []mall.MallGoods
err = global.GVA_DB.Model(&mall.MallGoods{}).Where("id in ?", Ids).Find(&mallGoods).Error
for _, val := range mallGoods {
for k, valuein := range dataRes {
if valuein.Pid == int(val.ID) {
dataRes[k].Title = val.Title
dataRes[k].Price = *val.Price
// 错误代码
//valuein.Title = val.Title
//valuein.Price = *val.Price
//fmt.Println(valuein.Price)
}
}
}踩坑, 用 结构体的key 去修改值,使用 value 修改值是改不了的
边栏推荐
- Differences between JSON objects and JSON strings
- GenICam GenTL 标准 ver1.5(3)第四章
- Exploring the depth of objects in JVM series
- 消息队列之通过队列批处理退款订单
- [software test] interface - Basic test process
- Summary of some new datasets proposed by cvpr2021
- Markdown 技能树(9):表格
- RPC and RMI
- . Net core + DDD basic layering + project basic framework + personal summary "suggestions collection"
- 电子商务盛行,怎么提高商店转换率?
猜你喜欢
随机推荐
Chinese garbled code on idea console [valid through personal test]
Digital IC Design - UART
NoSQL数据库之Redis(二):Redis配置文件介绍
电子商务盛行,怎么提高商店转换率?
QT program packaging and publishing windeployqt tool
Solve the problem that NPM does not have permission
QT STL type iterator
shell条件判断详解
uva10859
软件工程师与软件开发区别? Software Engineer和Software Developer区别?
利用Jsonp跨域请求数据
Introduction to Ceres Quartet
更改主机名的方法(永久)
Unexpected exception ... code: Badrequest when downloading Xilinx 2018.2
Multimodal learning pooling with context gating for video classification
Qt QLineEdit详解
Twitter launches the test of anti abuse tool "safe mode" and adds enabling prompt
Daily question - force deduction - multiply the found value by 2
LeetCode_动态规划_中等_91. 解码方法
Draw multiple ROC curves on a graph







