Fix tests
This commit is contained in:
parent
5bfaa7c843
commit
89002a2625
|
@ -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
|
||||
}
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue