When updating with association using gorm.Session{FullSaveAssociations: true}) and .Updates() method it updates main model skipping zero values, but for association it behaves differently. It updates all fields including zero values, although one would expect that main model and associations should have same behaviour during update.
So maybe there are some ways to update association ignoring zero values?
The document you expected this should be explained
Your Question
When updating with association using
gorm.Session{FullSaveAssociations: true})
and.Updates()
method it updates main model skipping zero values, but for association it behaves differently. It updates all fields including zero values, although one would expect that main model and associations should have same behaviour during update.So maybe there are some ways to update association ignoring zero values?
The document you expected this should be explained
I didn't find options to skip updating zero values for associations in documentation. There are Omit options but it only works for particular columns: https://gorm.io/docs/associations.html#Skip-Auto-Create-x2F-Update
I found similar issues related to this, but with no response: https://github.com/go-gorm/gorm/issues/5724
Expected answer