Answer the question
In order to leave comments, you need to log in
GORM: Why is an error thrown when creating a structure and saving it to the sqlite database with a ForeignKey, but with a different name in the column?
Used by SQLite.
There are 2 structures:
type Compaing struct {
Id int
Name string `sql:"type:varchar(250)"`
Groups []Group
}
type Group struct {
Id int
Name string `sql:"type:varchar(1500)"`
GroupIdq string `sql:"type:varchar(250)"`
CompaingId int `gorm:"column:to_compaing_id"`
}
Compaing{
{
Name: "New compaing",
Available: true,
Deleted: false,
Groups: []Group{
{
Name: "123",
},
},
},
},
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question