当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
软件开发工具的技术要素
从单体架构迁移到 CQRS 后,我觉得 DDD 并不可怕
【无标题】
IDEA file encoding modification
Mysql_14 存储引擎
大师教你3D实时角色制作流程,游戏建模流程分享
MongoDB权限验证开启与mongoose数据库配置
再肝3天,整理了90个 NumPy 例子,不能不收藏!
MAUI Blazor 权限经验分享 (定位,使用相机)
数据类型-整型(C语言)
机器学习(公式推导与代码实现)--sklearn机器学习库
Implementation principle of golang coroutine
数据类型及输入输出初探(C语言)
日志(logging模块)
redis可视化管理软件Redis Desktop Manager2022
After another 3 days, I have sorted out 90 NumPy examples, and I can't help but bookmark it!
Huggingface入门篇 II (QA)
gorm联表查询-实战
标识符、关键字、常量 和变量(C语言)
软件质量评估的通用模型









