diff --git a/g/database/gdb/gdb_model.go b/g/database/gdb/gdb_model.go index 77287e4f2..d2f145787 100644 --- a/g/database/gdb/gdb_model.go +++ b/g/database/gdb/gdb_model.go @@ -347,7 +347,7 @@ func (md *Model) Count() (int, error) { } if len(list) > 0 { for _, v := range list[0] { - return gconv.Int(v), nil + return v.Int(), nil } } return 0, nil diff --git a/g/database/gdb/gdb_type_value.go b/g/database/gdb/gdb_type_value.go index de27a432e..e2481b89e 100644 --- a/g/database/gdb/gdb_type_value.go +++ b/g/database/gdb/gdb_type_value.go @@ -12,23 +12,23 @@ import ( ) func (v Value) Bytes() []byte { return []byte(v) } -func (v Value) String() string { return string(v) } -func (v Value) Bool() bool { return gconv.Bool(v) } +func (v Value) String() string { return string(v.Bytes()) } +func (v Value) Bool() bool { return gconv.Bool(v.Bytes()) } -func (v Value) Int() int { return gconv.Int(v) } -func (v Value) Int8() int8 { return gconv.Int8(v) } -func (v Value) Int16() int16 { return gconv.Int16(v) } -func (v Value) Int32() int32 { return gconv.Int32(v) } -func (v Value) Int64() int64 { return gconv.Int64(v) } +func (v Value) Int() int { return gconv.Int(v.Bytes()) } +func (v Value) Int8() int8 { return gconv.Int8(v.Bytes()) } +func (v Value) Int16() int16 { return gconv.Int16(v.Bytes()) } +func (v Value) Int32() int32 { return gconv.Int32(v.Bytes()) } +func (v Value) Int64() int64 { return gconv.Int64(v.Bytes()) } -func (v Value) Uint() uint { return gconv.Uint(v) } -func (v Value) Uint8() uint8 { return gconv.Uint8(v) } -func (v Value) Uint16() uint16 { return gconv.Uint16(v) } -func (v Value) Uint32() uint32 { return gconv.Uint32(v) } -func (v Value) Uint64() uint64 { return gconv.Uint64(v) } +func (v Value) Uint() uint { return gconv.Uint(v.Bytes()) } +func (v Value) Uint8() uint8 { return gconv.Uint8(v.Bytes()) } +func (v Value) Uint16() uint16 { return gconv.Uint16(v.Bytes()) } +func (v Value) Uint32() uint32 { return gconv.Uint32(v.Bytes()) } +func (v Value) Uint64() uint64 { return gconv.Uint64(v.Bytes()) } -func (v Value) Float32() float32 { return gconv.Float32(v) } -func (v Value) Float64() float64 { return gconv.Float64(v) } +func (v Value) Float32() float32 { return gconv.Float32(v.Bytes()) } +func (v Value) Float64() float64 { return gconv.Float64(v.Bytes()) } -func (v Value) Time(format...string) time.Time { return gconv.Time(v, format...) } -func (v Value) TimeDuration() time.Duration { return gconv.TimeDuration(v) } \ No newline at end of file +func (v Value) Time(format...string) time.Time { return gconv.Time(v.Bytes(), format...) } +func (v Value) TimeDuration() time.Duration { return gconv.TimeDuration(v.Bytes()) } \ No newline at end of file