A complex update in GORM
问题 I have a model in GORM with Postgres as database. The model is like this type Country struct { gorm.Model Name string Population int64 Regions []Region } type Region struct { gorm.Model Name string Cities []City CountryID uint `sql:"type:bigint REFERENCES countries(id) ON DELETE CASCADE" json:"-"` } type City struct { gorm.Model Name string Comment string RegionID uint `sql:"type:bigint REFERENCES regions(id) ON DELETE CASCADE" json:"-"` } When I create a new record from model, I invoke