GORM Playground Link
https://github.com/go-gorm/playground/pull/605
Description
Hi!
I am having this problem when I try to Create an instance (in this case), of the planet struct.
Planet, when does not have id, this must be retreived from db due this has a default generate_uuid_v4()
When struct has the default:generate_uuid_v4() tag gets the uuid from db, but when you provide the id manually this is not included in query
Am i doing something wrong or it is an issue?. I have tried setting -> tag, but the problems persists
Comment From: a631807682
type Planet struct {
PlanetData
- ID uuid.UUID `gorm:"->"`
+ ID uuid.UUID `gorm:"default:generate_uuid_v4()"`
IsBig bool
}
type PlanetWithDefault struct {
PlanetData
- ID uuid.UUID `gorm:"->;default:generate_uuid_v4()"`
+ ID uuid.UUID
IsBig bool
}