Preload with settings, close

This commit is contained in:
Jinzhu 2021-01-15 17:15:59 +08:00
parent 79628be2c2
commit 59fa07953c
1 changed files with 5 additions and 0 deletions
callbacks

View File

@ -22,6 +22,11 @@ func preload(db *gorm.DB, rels []*schema.Relationship, conds []interface{}) {
inlineConds []interface{}
)
db.Statement.Settings.Range(func(k, v interface{}) bool {
tx.Statement.Settings.Store(k, v)
return true
})
if len(rels) > 1 {
reflectValue = schema.GetRelationsValues(reflectValue, rels[:len(rels)-1])
}