add tag "ALWAYSUPDATE" to update zero value

This commit is contained in:
sdghchj 2020-12-31 09:21:45 +08:00 committed by GitHub
parent d96acc5df6
commit 04f8798a85
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -239,6 +239,9 @@ func ConvertToAssignments(stmt *gorm.Statement) (set clause.Set) {
value = stmt.DB.NowFunc().Unix()
}
isZero = false
} else if isZero {
_, isZero = field.TagSettings["ALWAYSUPDATE"]
isZero = !isZero
}
if ok || !isZero {