Your Question
In gorm V1 , the value of the ignored field gorm:"-" will changed after update
type User struct {
gorm.Model
UserID uint
Age uint `gorm:"-"`
}
// Age Initialize to 0 , updates to 18 now.
db.Model(u).Updates(&User{Age: 18})
// log
u.Age = 0 before update.
u.Age = 18 after update.
In gorm V2 now , the value will not changed.
u.Age = 0 before update.
u.Age = 0 after update.
GORM Playground link : https://github.com/go-gorm/playground/pull/480
Is this behavior change a bug ?
If not , is there a writing style to get results like V1 ?
Thanks so much !
The document you expected this should be explained
Expected answer
Comment From: XBreath
this question move to https://github.com/go-gorm/gorm/issues/5386