Skip to content

Commit 0ab77f1

Browse files
Fix dbo test case
1 parent 402c4af commit 0ab77f1

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

tests/models/person.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,14 @@ import "gorm.io/gorm"
55
type Person struct {
66
ID uint64 `json:"id" gorm:"primaryKey;column:id;autoIncrement"`
77
Name string `gorm:"index;column:name"`
8-
Cars []*Car `gorm:"foreignKey:OwnerID" gokit-dbo:"preload"`
9-
Movies []*Movie `gorm:"foreignKey:OwnerID" gokit-dbo:"preload"`
8+
Cars []*Car `gorm:"foreignKey:OwnerID"`
9+
Movies []*Movie `gorm:"foreignKey:OwnerID"`
1010
}
1111

12-
func (x Person) MoviesPreloader(db *gorm.DB) *gorm.DB {
12+
func (x Person) PreloadCars(db *gorm.DB) *gorm.DB {
13+
return db
14+
}
15+
16+
func (x Person) PreloadMovies(db *gorm.DB) *gorm.DB {
1317
return db.Where("movie.isSeries = ?", false)
1418
}

0 commit comments

Comments
 (0)