So i got two tables
type Person struct {
ID int
FirstName string
LastName string
Functions []Function
}
type Function struct {
gorm.Model
Info string
Person Person
}
Now I create the tables like this
db.AutoMigrate(&models.Person{}, &models.Function{})
After this I init the db
user := models.Person{
FirstName: "Isa",
LastName: "istcool",
Functions: []models.Function{{Info: "Trainer"}, {Info: "CEO"}},
}
db.Create(&user)
Now the problem is that my Person table only got Firstname and Lastname column and my Function table only got info column. But when I start my GET request I get people with the column function which is always null.
http://imgur.com/74RU2Va (A screenshot from my GET request and my db) To see my whole programm visit my github repo: https://github.com/Gnadlinger/SpommunicateBackend.git