You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Scan error on column index 9, name "DISCOUNT": reflect.Value.
Convert: value of type decimal.
Decimal cannot be converted to type float32 on column DISCOUNT"
scanner:
func (f *refScanner) Scan (src interface{}) (err error) {
defer func(){
if r := recover(); r != nil {
if s, ok := r.(string); ok {
err = errors.New(s + " on column `" + f.ColumnName + "`")
} else {
err = errors.New(fmt.Sprintf("<%T>: %s on column `%s`", r, r, f.ColumnName))
}
}
}()
sv := reflect.ValueOf(src)
if sv.IsValid() {
k := sv.Kind()
if k == reflect.Ptr || k == reflect.Interface {
if sv.IsNil() {
return
}
sv = sv.Elem()
}
if f.Destination.Kind() == reflect.Slice && f.Destination.Type().Elem().Kind() != reflect.Struct {
f.Destination.Set(sv.Convert(f.Destination.Type()))
} else
if f.Destination.Kind() == reflect.Slice {
// the slice must extends in each iteration
currCap := f.Destination.Cap()
currLen := f.RowsCount // needed len
// extends if needed
if currLen > currCap {
newCap := (currLen + currCap / 2) + 4
newSlice := reflect.MakeSlice(f.Destination.Type(), currLen, newCap)
reflect.Copy(newSlice, *f.Destination)
f.Destination.Set(newSlice)
}
// each iteration, remember
f.Destination.SetLen(currLen)
field := f.Destination.Index(f.RowsCount - 1).Field(f.Index)
if field.Kind() == reflect.ValueOf(&(time.Time{})).Kind() && field.IsNil() {
field.Set(reflect.New(field.Type().Elem()))
field = field.Elem()
}
field.Set(sv.Convert(field.Type()))
} else {
if f.Destination.Kind() == reflect.ValueOf(&(time.Time{})).Kind() && f.Destination.IsNil() {
f.Destination.Set(reflect.New(f.Destination.Type().Elem()))
f.Destination.Elem().Set(sv.Convert(f.Destination.Elem().Type()))
} else {
f.Destination.Set(sv.Convert(f.Destination.Type()))
}
}
return
}
return
}
sql procedure signature:
procedure get_list(
session char(16) character set octets,
fltid varchar(64),
fskip integer,
fcount integer,
sorted varchar(10),
approved boolean
)returns(
created timestamp,
client_uuid char(16) character set octets,
group_uuid char(16) character set octets,
fullname varchar(64),
ctype varchar(64),
pic varchar(64),
ncountry varchar(64),
country_code varchar(64),
ncity varchar(64),
city_uuid char(16) character set octets,
discount numeric(4,2),
like_rate numeric(4,2),
balance numeric(18,4),
likes int,
gift int,
toptags varchar(2048),
errcode integer,
err varchar(250)
);
Scan error on column index 9, name "DISCOUNT": reflect.Value.
Convert: value of type decimal.
Decimal cannot be converted to type float32 on column
DISCOUNT
"scanner:
sql procedure signature:
Struct:
The text was updated successfully, but these errors were encountered: