Fix tests

This commit is contained in:
Lunny Xiao 2020-03-09 11:13:58 +08:00
parent 5bfaa7c843
commit 89002a2625
No known key found for this signature in database
GPG Key ID: C3B7C91B632F738A
3 changed files with 5 additions and 2 deletions

View File

@ -50,6 +50,9 @@ func IsZero(k interface{}) bool {
}
func IsValueZero(v reflect.Value) bool {
if IsZero(v) {
return true
}
if IsZero(v.Interface()) {
return true
}

View File

@ -567,7 +567,7 @@ func (session *Session) genInsertColumns(bean interface{}) ([]string, []interfac
}
fieldValue := *fieldValuePtr
if col.IsAutoIncrement && fieldValue.IsZero() {
if col.IsAutoIncrement && utils.IsValueZero(fieldValue) {
continue
}

View File

@ -473,7 +473,7 @@ func (session *Session) genUpdateColumns(bean interface{}) ([]string, []interfac
}
fieldValue := *fieldValuePtr
if col.IsAutoIncrement && fieldValue.IsZero() {
if col.IsAutoIncrement && utils.IsValueZero(fieldValue) {
continue
}