I need to find all students
that belong to a school
with a certain name
.
type School struct {
gorm.Model
Students []Student
}
type Student struct {
gorm.Model
name string
SchoolID uint
}
I try this per the docs but it doesn't give me anything:
Database.Preload("Students", "name = ?", name).Find(&schools)
How can I achieve this with gorm?