|
Hi,
Thanks for the nice framework.
I'm a Scala newbie, and attempting to use dispatch.couch.
I couldn't find any examples for binding/extracting Couch responses to pojos using the dispatch.Doc and dispatch.Id classes.
By looking through the codeusing the liftweb json parser, I got the following to work for me:
import dispatch._
import dispatch.couch._
import net.liftweb.json.DefaultFormats
import net.liftweb.json.JsonParser._
val http = new Http
val db = Db(Couch(), "example")
val text = http(db / "02a678af5d7408bf812fecc5d1d693ae" as_str)
implicit val formats = new DefaultFormats
val json = parse(text)
var pojo = json.extract[MyPojo] // MyPojo is a simple case class
println(pojo)
This works okay, but wondering how I could do the equivalent using Doc and Id without using the liftweb parser?
Thanks!
|