I have a problem with formatting when using sqlx
rows, err = db.Queryx(query)
for rows.Next() {
results := make(map[string]interface{})
err = rows.MapScan(results)
fmt.Fprintf(w,"%#v \n", results)
}
The output when using %#v
fmt.Fprintf(w,“%#v \n”, results)
map[string]interface {}{"USER_ID”:”JD”, "USER_NAME”:”John Doe”}
map[string]interface {}{"USER_ID”:”JAD”, "USER_NAME”:”Jane Doe”}
map[string]interface {}{"USER_ID”:”DD”, "USER_NAME”:”Donald Duck”}
Using only %v
fmt.Fprintf(w,“%v \n”, results)
map[USER_ID:JD USER_NAME:John Doe]
map[USER_ID:JAD USER_NAME:Jane Doe]
map[USER_ID:DD USER_NAME:Donald Duck]
The desired output is to get rid of map[string]interface {}
{"USER_ID”:”JD”, "USER_NAME”:”John Doe”}
{"USER_ID”:”JAD”, "USER_NAME”:”Jane Doe”}
{"USER_ID”:”DD”, "USER_NAME”:”Donald Duck”}
Is this possible using sqlx?