I just port your node.js code (in your former version) to golang :
session, err := r.Connect(r.ConnectOpts{
Address: "localhost:28015",
})
if err != nil {
return
}
res, err := table.ConcatMap(func(customer r.Term) interface{} {
return customer.Field("purchases").Map(func(purchase r.Term) interface{} {
return map[string]interface{}{
"zip": customer.Field("address").Field("zip"),
"product": purchase.Field("name"),
}
})
}).Run(session)
if err != nil {
return
}
defer res.Close()
var response interface{}
for res.Next(&response) {
fmt.Println(response)
}