SQL I want to implement
select * from movies left join server on movies.server_id = server.id
here is my go code. I don"t know what the problem is. The data of the queried server field is not correct
.type Server struct {
Id int64 `gorm:"primary_key"`
Domain string
}
type Movie struct {
Id int64 `gorm:"primary_key"`
Count int64
Status int
Name string
ServerId int
Path string
CategoryId int
CreatedAt time.Time `grom:"column:created_at"`
UpdatedAt time.Time `grom:"column:updated_at"`
Server Server `gorm:"foreignkey:id;association_foreignkey:server_id;auto_preload"`
}
//
var movie orm.Movie
d := orm.Db.Find(&movie)