Your Question

The model struct to AutoMigrate(correspond to db table, call it DAO) is different to the struct to receive gorm query result(such as .First() .Take(), call it DTO), and I use features like many2many and polymorphic.

The document you expected this should be explained

https://gorm.io/zh_CN/docs/many_to_many.html

https://gorm.io/zh_CN/docs/polymorphism.html

Expected answer

Should I define struct tag like polymorphic and many2many in that field of DAO struct or DTO struct or both?