Tuesday, June 23, 2009

Settee

I had a little bit of free time and needed a couchdb wrapper in Scala, I looked around and stumbled upon the excellent Dispatch library written by n8than. I am in the processes of expanding the couchdb wrapper to include views. My initial work can be found here

To access a couchdb database when can use the Db object like so:

val db = Db(Couch(), "dbname")

To emit a view we can use:

val view = new View(db, "items", "by_tag-map") emit

This will will return a thunk that we can then evaluate like so:

http(view)

This will then return a List[JsValue] of the raw Json from the database. This library is still in the very early stages and I hope to add a whole lot more functionality soon.

No comments:

Post a Comment