Go client View function
Sat, 01/12/2013 - 08:13
Hey there, I'm kind of new to Go and Couchbase, but would like to use it.
I'm using this:
type line struct {
value string
}
params := map[string]interface{}{}
params["stale"] = line{"update_after"}
params["connection_timeout"] = line{"60000"}
params["limit"] = line{"10"}
params["skip"] = line{"0"}
vone, err3 := bucket.View("_design/search", string("getdomains"), params)and I get "vone: %s {0 [] []}". Using the admin UI that View with those options gives me 3 results.
http://godoc.org/github.com/couchbaselabs/go-couchbase#Bucket.View
Why?
It's unclear what you're trying to do here. Your "line" struct is unlikely to be understood by the library. I think it will if you implement MarshalJSON, but it looks like the long way around, though.
Also, the document part of the view request doesn't include the _design/ prefix. I'll update the docs to make this more clear (I had to look at one of my current examples to verify).
Does this work better?
params := map[string]interface{}{ "stale": "update_after", "connection_timeout", 60000, "limit": 10, "skip": 0, } vone, err := bucket.View("search", "getdomains", params)