improve type conversion for gdb

This commit is contained in:
John
2019-09-03 00:06:24 +08:00
parent acd5e72f6c
commit e2906fba0b
5 changed files with 25 additions and 7 deletions

View File

@ -10,6 +10,8 @@ import (
"fmt"
"strings"
"github.com/gogf/gf/text/gstr"
"github.com/gogf/gf/os/gtime"
"github.com/gogf/gf/encoding/gbinary"
@ -27,9 +29,15 @@ func (bs *dbBase) convertValue(fieldValue []byte, fieldType string) interface{}
return fieldValue
case "int", "tinyint", "small_int", "medium_int":
if gstr.ContainsI(fieldType, "unsigned") {
gconv.Uint(string(fieldValue))
}
return gconv.Int(string(fieldValue))
case "big_int":
if gstr.ContainsI(fieldType, "unsigned") {
gconv.Uint64(string(fieldValue))
}
return gconv.Int64(string(fieldValue))
case "float", "double", "decimal":