当前位置:网站首页>【golang】cannot unmarshal xxx “ into Go struct field xxx of type xxx
【golang】cannot unmarshal xxx “ into Go struct field xxx of type xxx
2022-07-16 13:23:00 【沉默小管】
问题原因
报错信息
cannot unmarshal number " into Go struct field homeWebDetailFormDataStruct.Id of type int
翻译
无法将数字“解组为 int 类型的 Go struct 字段 homeWebDetailFormDataStruct.Id
所以我需要把前端传输的值的类型转为int类型才行
解決流程
1.修改前端数据类型
错误代码:
//网站详情
const handleWebDetail = async () => {
//requestWebDetail为封装的请求类
//这里的id为number类型
let result: any = await requestWebDetail({
id:id})
xxx...
}
正确代码:
const handleWebDetail = async () => {
//requestWebDetail为封装的请求类
//这里的id为number类型转为int
let result: any = await requestWebDetail({
id:id-0})
xxx...
}
踩坑不易,还希望各位大佬支持一下 \textcolor{gray}{踩坑不易,还希望各位大佬支持一下} 踩坑不易,还希望各位大佬支持一下
个人主页: \textcolor{green}{个人主页:} 个人主页:沉默小管
个人网站: \textcolor{green}{个人网站:} 个人网站:沉默小管
技术交流 Q Q 群: 837051545 \textcolor{green}{技术交流QQ群:837051545} 技术交流QQ群:837051545
点赞,你的认可是我创作的动力! \textcolor{green}{点赞,你的认可是我创作的动力!} 点赞,你的认可是我创作的动力!
️ 收藏,你的青睐是我努力的方向! \textcolor{green}{收藏,你的青睐是我努力的方向!} 收藏,你的青睐是我努力的方向!
️ 评论,你的意见是我进步的财富! \textcolor{green}{评论,你的意见是我进步的财富!} 评论,你的意见是我进步的财富!
如果有不懂可以留言,我看到了应该会回复
如有错误,请多多指教
边栏推荐
- Introduction to C language (7)
- 才22岁!这位“00后”博士拟任职985高校!
- 队列的基本操作
- If an element is above another element, clicking on the above element will trigger the following element event operation
- 已解决SQL_ERROR_INFO: “You have an error in your SQL syntax; check the manual that corresponds to your
- 开箱:阿里技术人在读什么书?
- 10个第一、2个第二,达摩院NLP团队在SemEval 2022的夺冠之旅
- log4j日志配置
- Dataset: detailed introduction, download and usage of white wine quality dataset
- module ‘sklearn. datasets‘ has no attribute ‘fetch_ mldata‘
猜你喜欢

Daemon threads and application scenarios

你的 MySQL 服务器还好吗?全球已超 3600000 台暴露在互联网上。。。

Unity游戏文件大,如何缩小游戏文件

定了,6大领域93个开源任务,阿里开源导师带你参与中科院开源之夏2022

JD finance, are you bad, or are you cutting too much??

ECCV 2022 | 适用于分类,检测,分割的生成式知识蒸馏开源

2022 hoisting machinery command examination simulation 100 questions simulation examination platform operation

Use plt When the savefig() method saves the drawing, the picture is all white or all black

UOS安装MariaDB

Today's sleep quality record 85 points
随机推荐
JD finance, are you bad, or are you cutting too much??
【C#网络应用编程】实验3:进程管理练习
It's decided. There are 93 open source tasks in 6 fields. Alibaba open source tutor will take you to participate in the open source summer 2022 of the Chinese Academy of Sciences
输入一个url全过程详解
【开发教程7】疯壳·开源蓝牙智能健康手表-充电
数据可视化之matplotlib绘制正余弦曲线图
定了,6大领域93个开源任务,阿里开源导师带你参与中科院开源之夏2022
[CVPR2019] On Stabilizing Generative Adversarial Training with Noise
2022年山东省安全员C证考试题库及答案
Image xmage de Huawei: Cherchez toutes les images du monde et voyez enfin Bodhisattva
Basic operation of stack
Tips for copying content in web pages without login account
已解决SQL_ERROR_INFO: “You have an error in your SQL syntax; check the manual that corresponds to your
ECCV 2022 | open source for generative knowledge distillation of classification, detection and segmentation
2022年G3锅炉水处理考试题库及模拟考试
一次有趣(想打断同事腿)的键盘BUG调试经历
L'art de l'annotation de code, un bon Code n'a - t - il vraiment pas besoin d'annotation?
2022 G3 boiler water treatment examination question bank and simulation examination
一个元素位于另一个元素之上,点击上面的元素引发下面元素事件操作
Thread. Introduction to sleep