当前位置:网站首页>Raw and scan of gorm
Raw and scan of gorm
2022-08-05 00:19:00 【Kageyuki three thousand】
Gorm's Raw and Scan
Raw
- Chinese: Native
Role: used to write Raw sql statements (native sql statements) when writing gorm statements
Gorm official introduction Scan:
https://gorm.io/en_US/docs/query.html#Scan
Scanning results into a struct works similarly to the way we use Find
Baidu Translate: Scanning results into a structure works like "Find"
type Result struct {Name stringAge int}var result Resultdb.Table("users").Select("name", "age").Where("name = ?", "Antonio").Scan(&result)// Raw SQLdb.Raw("SELECT name, age FROM users WHERE name = ?", "Antonio").Scan(&result
Summary: If you don't look at the source code, you don't have to worry about it. It can be understood that find is the same as scan.
Note: Generally, when writing a joint table query, scan will be used
边栏推荐
- 元宇宙:未来我们的每一个日常行为是否都能成为赚钱工具?
- 导入JankStats检测卡帧库遇到问题记录
- .net (C#) get year month day between two dates
- 图解 Canvas 入门
- 【idea】idea配置sql格式化
- Three tips for you to successfully get started with 3D modeling
- Brainstorm: Complete Backpack
- The role of the annotation @ EnableAutoConfiguration and how to use
- [Cloud Native--Kubernetes] Pod Controller
- node使用redis
猜你喜欢
随机推荐
找不到DiscoveryClient类型的Bean
MAUI Blazor 权限经验分享 (定位,使用相机)
GO中sync包自由控制并发的方法
oracle创建用户以后的权限问题
【LeetCode】Summary of Two Pointer Problems
Ab3d.PowerToys and Ab3d.DXEngine Crack
[LeetCode] Summary of Matrix Simulation Related Topics
【无标题】
统计单词(DAY 101)华中科技大学考研机试题
Cython
#yyds干货盘点#交换设备丢包严重的故障处理
对写作的一些感悟
2 用D435i运行VINS-fusion
[230]连接Redis后执行命令错误 MISCONF Redis is configured to save RDB snapshots
中日颜色风格
Some thoughts on writing
【LeetCode】矩阵模拟相关题目汇总
典型相关分析CCA计算过程
Three tips for you to successfully get started with 3D modeling
leetcode:269. 火星词典