I use the gorm with the has many。 This is my model
type Pro struct {
Model
TaxRate []TaxRate `json:"taxRate" gorm:"constraint:OnUpdate:CASCADE;"`
}
type TaxRate struct {
ID uint
Tax float64
ProjectID uint
}
but when I update the project, I found that the TaxRate just insert the record not update. This is my update operation
result:=pRepo.db.Session(&gorm.Session{FullSaveAssociations: true}).Updates(p)