当前位置:网站首页>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
边栏推荐
- 美团二面:Redis与MySQL双写一致性如何保证?
- How to burn the KT148A voice chip into the chip through the serial port and the tools on the computer
- 统计单词(DAY 101)华中科技大学考研机试题
- 在线中文姓名生成工具推荐
- leetcode经典例题——单词拆分
- 【LeetCode】Summary of Two Pointer Problems
- Modelers experience sharing: model study method
- Handwritten Distributed Configuration Center (1)
- "Relish Podcast" #397 The factory manager is here: How to use technology to empower the law?
- Mathematical Principles of Matrix
猜你喜欢
随机推荐
Xiaohei's leetcode journey: 95. Longest substring with at least K repeating characters
ARC129E Yet Another Minimization 题解 【网络流笔记】
E - Many Operations (按位考虑 + dp思想记录操作后的结果
【LeetCode】双指针题解汇总
GO中sync包自由控制并发的方法
E - Distance Sequence (前缀和优化dp
.net(C#)获取两个日期间隔的年月日
TinyMCE禁用转义
统计单词(DAY 101)华中科技大学考研机试题
动态上传jar包热部署
The master teaches you the 3D real-time character production process, the game modeling process sharing
MAUI Blazor 权限经验分享 (定位,使用相机)
【idea】idea配置sql格式化
英特尔WiFi 7产品将于2024年亮相 最高速度可达5.8Gbps
从单体架构迁移到 CQRS 后,我觉得 DDD 并不可怕
【云原生--Kubernetes】调度约束
Modelers experience sharing: model study method
node使用redis
D - I Hate Non-integer Number (选数的计数dp
After another 3 days, I have sorted out 90 NumPy examples, and I can't help but bookmark it!



![Couple Holding Hands [Greedy & Abstract]](/img/7d/1cafc000dc58f1c5e2e92150be7953.png)




