Merge pull request #142 from NicolasSamDuval/master

Support uint64 with high bit set.
This commit is contained in:
Lunny Xiao 2014-07-12 13:49:47 +08:00
commit 5f8a20eb1c
2 changed files with 6 additions and 2 deletions

View File

@ -2597,6 +2597,8 @@ func (session *Session) value2Interface(col *core.Column, fieldValue reflect.Val
} else {
return nil, ErrUnSupportedType
}
case reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64, reflect.Uint:
return int64(fieldValue.Uint()), nil
default:
return fieldValue.Interface(), nil
}

View File

@ -375,7 +375,8 @@ func buildUpdates(engine *Engine, table *core.Table, bean interface{},
if !requiredField && fieldValue.Uint() == 0 {
continue
}
val = fieldValue.Interface()
t := int64(fieldValue.Uint())
val = reflect.ValueOf(&t).Interface()
case reflect.Struct:
if fieldType == reflect.TypeOf(time.Now()) {
t := fieldValue.Interface().(time.Time)
@ -546,7 +547,8 @@ func buildConditions(engine *Engine, table *core.Table, bean interface{},
if !requiredField && fieldValue.Uint() == 0 {
continue
}
val = fieldValue.Interface()
t := int64(fieldValue.Uint())
val = reflect.ValueOf(&t).Interface()
case reflect.Struct:
if fieldType == reflect.TypeOf(time.Now()) {
t := fieldValue.Interface().(time.Time)