Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | SDKs | SDKs

Go client View function

3 replies [Last post]
  • Login or register to post comments
Sat, 01/12/2013 - 08:13
Me
Offline
Joined: 01/09/2013
Groups: None

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?

Top
  • Login or register to post comments
Thu, 01/17/2013 - 15:06
dustin
Offline
Joined: 03/15/2010
Groups: None

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)

Top
  • Login or register to post comments
Thu, 01/17/2013 - 15:17
dustin
Offline
Joined: 03/15/2010
Groups: None

I've updated the docs. I hope you find this helpful.

Top
  • Login or register to post comments
Sun, 01/20/2013 - 13:45
Me
Offline
Joined: 01/09/2013
Groups: None

Thanks, I have it working now. (Although it is slow. 6ms (cached) for a 3 items bucket)

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker