Reputation: 2228
Using sqlx in Golang with this code:
rows, err := db.Queryx(`SELECT "SIGN_ID","SIGN_NAME" FROM sign`)
for rows.Next() {
results := make(map[string]interface{})
err = rows.MapScan(results)
fmt.Printf("%#v\n", results)
}
The result looks really promising:
map[string]interface {}{"SIGN_ID":"JD", "SIGN_NAME":"John Doe"}
map[string]interface {}{"SIGN_ID":"JAD", "SIGN_NAME":"Jane Doe"}
map[string]interface {}{"SIGN_ID":"DD", "SIGN_NAME":"Donald Duck"}
map[string]interface {}{"SIGN_NAME":"Chris Walker", "SIGN_ID":"CW"} <----
map[string]interface {}{"SIGN_ID":"SN", "SIGN_NAME":"St Nicolas"}
Two questions:
map[string]interface {}{"SIGN_NAME":"Chris Walker", "SIGN_ID":"CW"}
Upvotes: 0
Views: 104
Reputation: 4569
fmt.Printf("%v\n", results)
Upvotes: 1