为了账号安全,请及时绑定邮箱和手机立即绑定

如何使用gorm将记录插入到现有的有很多表中

如何使用gorm将记录插入到现有的有很多表中

Go
沧海一幻觉 2021-10-18 13:56:26
我有两张桌子type Podcast struct {    Id       int    Title    string    RssUrl   string `sql:"unique_index"`    Episodes []Episode}type Episode struct {    Id         int    PodcastID  int    Title      string    Url        string `sql:"unique_index"`    Downloaded bool}我知道如何将剧集插入新的播客中。podcast := Podcast{    Title:    "My Podcast",    RssUrl:   "http://example.com/feed/",    Url:      "http://www.example.com",    Episodes: []Episode{{        Title:      "Episode One Point Oh!",         Url:        "http://www.example.com/one-point-oh",         Downloaded: false,    }},}db.Create(&podcast)我如何将剧集添加到以后已经存在的播客中?
查看完整描述

1 回答

  • 1 回答
  • 0 关注
  • 174 浏览
慕课专栏
更多

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号