http://www.aerospike.com/docs/client/go/usage/query/query.html
Executing Query provides Bins as result. Can I take object as result?
Now I use it:
stmt := as.NewStatement("bidder", "banner")
stmt.Addfilter(as.NewEqualFilter("CampaignID", id))
rs, err := db.client.Query(nil, stmt)
if err != nil {
return nil
}
banner := make(map[int]*Banner)
for res := range rs.Results() {
if res.Err != nil {
panic(res.Err)
}
banner[res.Record.Bins["ID"].(int)] = &Banner{
ID: res.Record.Bins["ID"].(int),
CampaignID: res.Record.Bins["CampaignID"].(int),
Shows: res.Record.Bins["Shows"].(int),
Name: res.Record.Bins["Name"].(string),
Width: res.Record.Bins["Width"].(string),
Height: res.Record.Bins["Height"].(string),
Type: res.Record.Bins["Type"].(string),
}
}
And I need duplicate key in a bin name, becaus query don’t return key. This is the right decision?