【发布时间】:2021-04-20 15:54:18
【问题描述】:
又是我。 我现在可以在gorm中预加载... 但问题现在扩大了。 我有 3 个需要获取数据的结构 首先是
type Deal struct{
DealId int
Attachments []Attachment
}
type Attachment struct{
DealId int
ProductId int
AttachmentId int
Product
}
type Product struct{
ProductId int
}
那么如何使用我的 3 张桌子在 gorm 中进行连接和预加载?有什么建议吗? 我需要与所有附件达成协议...尝试不使用产品是可以的。但是当需要产品时......问题是我无法在预加载时将其与附件连接起来 谢谢
【问题讨论】:
标签: go