This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def test = Action { | |
// Solution la plus générique | |
Async { | |
val futureA = WS.url("xx").get | |
val futureB = WS.url("yy").get | |
val resultAB = for { | |
resA <- futureA | |
resB <- futureB | |
} yield (resA, resB) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// searches for nodes by filtering on key value | |
def filter(jsv: JsValue, filterFn: String => Boolean): Seq[JsValue] = { | |
jsv match { | |
case JsObject(fields) => fields.toMap.foldLeft(Seq[JsValue]())((o, pair) => pair match { | |
case (key, value) if filterFn(key) => o ++ (value +: (filter(value, filterFn))) | |
case (_, value) => o ++ (filter(value, filterFn)) | |
}) | |
case _ => Seq[JsValue]() | |
} | |
} |