I hereby claim:
- I am applethepeanut on github.
- I am applethepeanut (https://keybase.io/applethepeanut) on keybase.
- I have a public key ASCBtCCi5O3cEZWvjQBrw9XnkN9ZSCd4kFtLW7xI6rRZhAo
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
I hereby claim:
To claim this, I am signing this object:
case class Blah(id: String, name: String) | |
object Blah { | |
implicit val jsonFormats = new RootJsonFormat[Blah] { | |
override def read(json: JsValue): Blah = { | |
val js = json.asJsObject | |
(js.fields("some_id"), js.fields("some_name")) match { | |
case (JsString(id), JsString(name)) => Blah(id, name) |
implicit object AccountReader extends BSONDocumentReader[Account] { | |
override def read(bson: BSONDocument): Account = { | |
val account: Option[Account] = for { | |
id <- bson.getAs[BSONObjectID]("_id") | |
... | |
} yield new Account(id, ...) | |
account.getOrElse(boom) | |
} | |
} |