当前位置:网站首页>go : go gin返回JSON数据
go : go gin返回JSON数据
2022-07-30 05:51:00 【行人已】
吃别人吃不了的苦,忍别人受不了的气,付出比别人更多的,才会享受的比别人更多 !!!
具体代码在: https://gitee.com/hjx_RuGuoYunZhiDao/strom-huang-go/tree/master/go_web_gin
1、其他写在前面
其他代码可以参考我上一篇文章:https://blog.csdn.net/bei_FengBoby/article/details/124847078
2、gin返回Json代码
Bool := IsExistUser(name)
var r = &result.R{
}
if Bool {
//核对密码
b := IsExistPwd(name, password)
if !b {
r.Code = 500
r.Msg = "用户不存在"
} else {
r.Code = 200
r.Msg = "欢迎"
}
} else {
r.Code = 500
r.Msg = "用户不存在"
}
//主要是这里-----------------
c.JSON(http.StatusOK, r)
边栏推荐
- STL源码剖析:class template explicit specialization代码测试和理解
- How does Redis prevent oversold and inventory deduction operations?
- RAID disk array
- The calculation of the determinant of the matrix and its source code
- 2020年度总结——品曾经,明得失,展未来
- Local Implicit Grid Representations for 3D Scenes详解
- PXE高效批量网络装机
- MySQL什么时候用表锁,什么时候用行锁?
- Calculate the inverse source of the matrix (using the adjoint matrix, a 3x3 matrix)
- DHCP原理与配置
猜你喜欢
Linx common directory & file management commands & VI editor usage introduction
Selenium02
What happens when @Bean and @Component are used on the same class?
The calculation proof of the intersection of the space line and the plane and its source code
Network Protocol 03 - Routing and NAT
numpy 多维数组ndarray的详解
RAID磁盘阵列
[硬核干货]由0到1,突破信息系统项目管理师(呕心沥血经验之谈)!!!
进程和计划任务管理
搭建vsftpd服务并实现本地用户访问
随机推荐
首届人工智能安全大赛正式启动
UDP和TCP使用同一个端口,可行吗?
How does Redis prevent oversold and inventory deduction operations?
roslyn folder under bin folder
The terminal connection tools, rolling Xshell
ETL为什么经常变成ELT甚至LET?
Selenium01
The Society of Mind - Marvin Minsky
(GGG)JWT
和AI一起玩儿剧本杀:居然比我还入戏
阿里二面:Redis有几种集群方案?我答了4种
Test Development Engineer Growth Diary 010 - CI/CD/CT in Jenkins (Continuous Integration Build/Continuous Delivery/Continuous Testing)
Redis download and installation
Software Testing Terminology - Scenario Testing
空间顶点到直线的距离计算及其源码
人工肌肉智能材料新突破
识别“数据陷阱”,发现数据的可疑之处
LVM和磁盘配额
Derivative Operations on Vectors and Derivative Operations on Vector Cross and Dot Products
@Bean 与 @Component 用在同一个类上,会怎样?