• 请不要在回答技术问题时复制粘贴 AI 生成的内容
fxjson
V2EX  ›  程序员

gorm 关联查询问题咨询?

  •  
  •   fxjson · Jan 14, 2021 · 1313 views
    This topic created in 2006 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   ·   1233 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 26ms · UTC 17:22 · PVG 01:22 · LAX 10:22 · JFK 13:22
    ♥ Do have faith in what you're doing.