go version)?1.10
Postgres 9.4
Will provide soon. Basically, if I have
type model struct {
ID uuid.UUID
}
type Person struct {
model
Name string
Age int
}
func main() {
...
p := Person{"Bob", 34}
db.Create(&p)
fmt.Println(p.ID)
}
the ID doesn't get set.
I'm going to piggyback on this with a more complete example and a trace at my created issue #1952
I have created a repo as an example of this bug: https://github.com/ags799/gorm-1950
The ticket #1887 seems to be related, but using postgresql. They seem to have a working version with a postgres specific UUID extension.
@ags799 maybe you should use type Model struct instead of type model struct so that gorm can access the p.ID.
@zxdvd thanks this works
Most helpful comment
@ags799 maybe you should use
type Model structinstead oftype model structso that gorm can access thep.ID.