V2EX = way to explore
V2EX 是一个关于分享和探索的地方
Sign Up Now
For Existing Member  Sign In
• 请不要在回答技术问题时复制粘贴 AI 生成的内容
fxjson
V2EX  ›  程序员

gorm 关联查询问题咨询?

  •  
  •   fxjson · Jan 14, 2021 · 1159 views
    This topic created in 1929 days ago, the information mentioned may be changed or developed.

    type User struct { gorm.Model Name string AccountId uint Account Acount }

    type Account struct{ AccountId gorm:"primary_key" Age int } 获取的数据结构是 { id:1, name:"json", accountid:1, account:{ age:32, accountid:1 } } 怎么在不添加数据结构情况下得到下面的结构,就是将 age 提升到外面一级别 { id:1, name:"json", accountid:1, age:32, }

    No Comments Yet
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Solana   ·   6058 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 02:35 · PVG 10:35 · LAX 19:35 · JFK 22:35
    ♥ Do have faith in what you're doing.