You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
i'm using the v1 of the library , and i wonder if i'm using eager loading through a preload function like below, will it be faster & efficient if i return the relation with first function?
Your Question
i'm using the v1 of the library , and i wonder if i'm using eager loading through a preload function like below, will it be faster & efficient if i return the relation with first function?
From this:
tx := mc.mysqlDB.Select("personid").Preload("Person", func(db *gorm.DB) *gorm.DB {
return db.Select("details")
}).First(&book, "id = ?", id)
To this:
tx := mc.mysqlDB.Select("personid").Preload("Person", func(db *gorm.DB) *gorm.DB {
return db.Select("details").First(&Person{})
}).First(&book, "id = ?", id)
The document you expected this should be explained
Expected answer
is the first function a necessary call or is it useless in my case?
The text was updated successfully, but these errors were encountered: