GORM关联查询使用请教
1. 运行环境
[版本]: go version go1.18 windows/amd64
2. 问题描述?
Go语言使用GORM:
type Article struct {
ArticleScore ArticleScore `json:"article_score"`
}
type ArticleScore struct {
}
global.GlobalDb.Where("id = ?", id).Preload("ArticleScore").First(&art)
通过查询article表能preload出articlescore表相关的数据,反过来查articlescore表出不来article表的数据,请问反过来的话得怎么使用呀,请大神指点,谢谢
推荐文章: