当前位置:网站首页>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 修改值是改不了的
边栏推荐
- Who is the main body of the waiting insurance record? Record in the local network security, right?
- Spark RDD案例:统计每日新增用户
- 项目中 if else 的代替写法
- Markdown 技能树(9):表格
- 示波器 符号
- uva10859
- What does VPS do? What are the famous brands? What is the difference with ECS?
- 施工企业选择智慧工地的有效方法
- 多模态 —— Learnable pooling with Context Gating for video classification
- uva10859
猜你喜欢

利用IPv6實現公網訪問遠程桌面

Testing grpc service with grpcui

Tree drop-down selection box El select combined with El tree effect demo (sorting)

NoSQL数据库之Redis(一):安装 & 简介

通过keyup监听textarea输入更改按钮样式

Message queue avoiding repeated refund by idempotent design and atomic lock

Qt 程序打包发布-windeployqt工具

Ci tool Jenkins II: build a simple CI project

. NETCORE uses redis to limit the number of interface accesses

Qt 串口编程
随机推荐
LiveData源码赏析 —— 基本使用
BeanPostProcessor 和 BeanFactoryPostProcessor
What is the difference between software engineer and software development? What is the difference between software engineer and software developer?
uva11825
[software test] interface - Basic test process
软件工程师与软件开发区别? Software Engineer和Software Developer区别?
如何给下属进行授权?
NoSQL数据库之Redis(四):Redis的发布和订阅
ES 查询语法
Markdown 技能树(5):图片
Livedata source code appreciation - basic use
国家安全局和CISA Kubernetes加固指南--1.1版的新内容
Markdown 技能树(1):MarkDown介绍
Tree drop-down selection box El select combined with El tree effect demo (sorting)
QT serial port programming
Draw multiple ROC curves on a graph
【翻译】簇拥而出。构建现代应用程序的设计方法
Ci tools Jenkins installation configuration tutorial
Oscilloscope symbols
Chinese garbled code on idea console [valid through personal test]