惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

L
LangChain Blog
S
Secure Thoughts
博客园 - 三生石上(FineUI控件)
爱范儿
爱范儿
宝玉的分享
宝玉的分享
J
Java Code Geeks
博客园 - 司徒正美
量子位
酷 壳 – CoolShell
酷 壳 – CoolShell
腾讯CDC
S
SegmentFault 最新的问题
博客园 - 聂微东
Jina AI
Jina AI
C
CERT Recently Published Vulnerability Notes
Application and Cybersecurity Blog
Application and Cybersecurity Blog
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Threat Intelligence Blog | Flashpoint
Threat Intelligence Blog | Flashpoint
Hacker News: Ask HN
Hacker News: Ask HN
N
News and Events Feed by Topic
Y
Y Combinator Blog
Recent Announcements
Recent Announcements
PCI Perspectives
PCI Perspectives
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
博客园 - 叶小钗
P
Proofpoint News Feed
Stack Overflow Blog
Stack Overflow Blog
I
Intezer
P
Privacy & Cybersecurity Law Blog
小众软件
小众软件
I
InfoQ
S
Security Affairs
B
Blog RSS Feed
L
Lohrmann on Cybersecurity
Microsoft Azure Blog
Microsoft Azure Blog
Engineering at Meta
Engineering at Meta
T
Threat Research - Cisco Blogs
Hacker News - Newest:
Hacker News - Newest: "LLM"
H
Help Net Security
T
Tailwind CSS Blog
C
Check Point Blog
A
About on SuperTechFans
Google DeepMind News
Google DeepMind News
C
Cybersecurity and Infrastructure Security Agency CISA
Recorded Future
Recorded Future
Martin Fowler
Martin Fowler
奇客Solidot–传递最新科技情报
奇客Solidot–传递最新科技情报
Simon Willison's Weblog
Simon Willison's Weblog
Blog — PlanetScale
Blog — PlanetScale
Cisco Talos Blog
Cisco Talos Blog
C
CXSECURITY Database RSS Feed - CXSecurity.com

博客园 - 代码小伙

gin框架使用zap,在日志中加入trace_id gorm使用gen自动生成模型和查询文件 Go使用base64Captcha生成字母验证码 GoFrame框架使用WherePri报错原因 GoFrame框架使用BindHandler设置路由失效的原因 GoFrame框架WebServer默认端口号是什么 GoFrame框架SetFileServerEnabled关闭静态服务不生效 vite修改端口号 用路由方式写一个通用的微信小程序校验文件验证 手机网页通过微信deeplink实现wap支付 position:sticky失效原因分析 mysql把一个表的字段赋值到另一张表 基于jquery的countdown插件实现毫秒倒计时 Vue打包代码如何部署在ThinkPHP项目里 保姆级教程,centos7安装erlang和rabbitmq Element Plus表单resetFields重置表单无效 thinkphp6通过中间件设置跨域 centos7安装jdk vue3中使用swiper6实现轮播
GoFrame框架查询数据表时对字段取别名
代码小伙 · 2025-09-15 · via 博客园 - 代码小伙

两种方式,

  • 基于模型的Fields方法
dao.User.Where("id",1).Fields("name as `nickname`","id as `uid`").All()
  • 基于结构体orm标签的映射关系
type UserData struct {
  Uid int `json:"id" orm:"id"`
  Nickname string `json:"nickname" orm:"name"`
}

var user *entity.User
dao.User.Where("id",1).Scan(&user)