如果我想要多级关联的话我应该怎么做?
假设我有个文件表
又有一个文件数据表他与文件表是多对一的关系并且文件数据表为多
这个时候业务通常是通过关联文件数据表来获取文件的uri。例如用户有一个头像。这时如果我想通过查询用户同时将用户头像的uri查询出来我该如何调用方法
The document you expected this should be explained
https://gorm.io/zh_CN/docs/associations.html
Expected answer
请告诉具体的调用方法的方式,谢谢
Comment From: chen-mou
我使用的gorm版本为v8
Comment From: a631807682
From your description you need to define as has many and query through Preload https://gorm.io/zh_CN/docs/many_to_many.html#Many-To-Many https://gorm.io/docs/preload.html#Preload