fix query string bug when value is nil (#692)

This commit is contained in:
Lunny Xiao 2017-08-26 09:38:40 +08:00 committed by GitHub
parent a10b5aba4b
commit d7f04c3cec
1 changed files with 3 additions and 3 deletions

View File

@ -219,16 +219,16 @@ func row2mapStr(rows *core.Rows, fields []string) (resultsMap map[string]string,
for ii, key := range fields { for ii, key := range fields {
rawValue := reflect.Indirect(reflect.ValueOf(scanResultContainers[ii])) rawValue := reflect.Indirect(reflect.ValueOf(scanResultContainers[ii]))
//if row is null then ignore // if row is null then as empty string
if rawValue.Interface() == nil { if rawValue.Interface() == nil {
//fmt.Println("ignore ...", key, rawValue) result[key] = ""
continue continue
} }
if data, err := value2String(&rawValue); err == nil { if data, err := value2String(&rawValue); err == nil {
result[key] = data result[key] = data
} else { } else {
return nil, err // !nashtsai! REVIEW, should return err or just error log? return nil, err
} }
} }
return result, nil return result, nil