gorm v2:如何处理 v1 中的内容 gorm.Scope?

gorm v2: what to do with what in v1 was gorm.Scope?

我正在将 GORM 迁移到 v2。 gorm.Scope 已在此版本的 GORM 中删除。我需要 TableName()、FieldByName() 等。是否有一些具有相同功能的替代品?

jinzhu回答:

https://gorm.io/docs/write_plugins.html

db.Statement.Schema.LookUpField("Name")
db.Statement.Table