当前位置:网站首页>Golang modifying the value of a structure slice
Golang modifying the value of a structure slice
2022-06-29 07:25:00 【My forest】
// Complete product information , Product name , product price
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
// Error code
//valuein.Title = val.Title
//valuein.Price = *val.Price
//fmt.Println(valuein.Price)
}
}
}Step on the pit , use Structure of the key To modify the value , Use value You can't change the value
边栏推荐
- Two ways to write throttling - recently seen
- Webrtc series - 8-connectivity detection for network transmission
- How to fix Error: Failed to download metadata for repo ‘appstream‘: Cannot prepare internal mirrorli
- 【翻译】Bink如何为英国一些最大的银行的数字忠诚度交易提供动力
- A hybrid model of machine learning notes time series
- Shift/space studio "Aurora" project: building a villa in the sandbox metauniverse
- BeanPostProcessor 和 BeanFactoryPostProcessor
- Markdown 技能树(3):标题
- 期末总结——Spark
- uva10859
猜你喜欢

The meaning and calculation method of receptive field

IDEA 集成 码云

机器学习笔记 - 时间序列使用机器学习进行预测

CI工具Jenkins安装配置教程

HANA数据库License的查看申请及安装

Redis of NoSQL database (I): Installation & Introduction

Uniapp obtains the date implementation of the beginning and end of the previous month and the next month

Spark RDD case: Statistics of daily new users

Testing grpc service with grpcui

Ci tool Jenkins II: build a simple CI project
随机推荐
QT STL type iterator
ES 查询语法
SAP UI5 初学 ( 一 )、简介
1183:病人排队
How to select CRM brand suppliers in garment industry?
Suggestions on digital transformation of large chemical enterprises
Markdown 技能树(6):列表
The meaning and calculation method of receptive field
Unexpected exception ... code: Badrequest when downloading Xilinx 2018.2
Oscilloscope symbols
QT container class
[answer all questions] CSDN question and answer function evaluation
LSTM神经网络和普通神经网络的使用
机器学习笔记 - 时间序列的混合模型
WordPress adds article topping, password protection, and privacy Tags
国家安全局和CISA Kubernetes加固指南--1.1版的新内容
【翻译】Bink如何为英国一些最大的银行的数字忠诚度交易提供动力
Utilisation d'IPv6 pour réaliser l'accès public au bureau distant
Two ways to write throttling - recently seen
[qnx hypervisor 2.2 user manual]6.2.1 communication between guests