add IsZero check for custom struct column in the Update method

This commit is contained in:
tyler 2024-02-22 18:50:59 +08:00
parent 0c9a2f6a70
commit 81bf7ac1eb
1 changed files with 3 additions and 0 deletions

View File

@ -126,6 +126,9 @@ func (statement *Statement) BuildUpdates(tableValue reflect.Value,
if fieldValue.CanAddr() {
if structConvert, ok := fieldValue.Addr().Interface().(convert.Conversion); ok {
if utils.IsZero(fieldValue.Interface()) {
continue
}
data, err := structConvert.ToDB()
if err != nil {
return nil, nil, err