With the following struct I got the error:
[2016-05-05 21:10:16] using unaddressable value
type Channel struct {
ID uint `gorm:"primary_key"`
ChannelID string `json:"channel_id"`
Group string `json:"group"`
Image bool `json:"image"`
IsAtsc bool `json:"is_atsc"`
IsCable bool `json:"is_cable"`
IsRadio bool `json:"is_radio"`
IsSat bool `json:"is_sat"`
IsTerr bool `json:"is_terr"`
Name string `json:"name"`
Number int `json:"number"`
Stream string `json:"stream"`
Transponder int `json:"transponder"`
}
If I drop the ID column and use gorm.Model instead I got:
[2016-05-05 21:50:18] Error 1292: Incorrect datetime value: '0000-00-00' for column 'created_at' at row 1
Also I noticed that I got some issues with boolean, the mysql column was creates wit TINYINT(1) but it failes with given "true" or "false"
Maybe the mysql driver isn't that ready yet? Or did I something wrong?
Do you recommend to use sqlite instead?
Any ideas?
I just tried sqlite, but still the same...
Weird, hmm then I will proceed without an ORM for now.
you need to use pointer of value like db.Save(&User{})
Most helpful comment
you need to use pointer of value like
db.Save(&User{})