Skip to content

Instantly share code, notes, and snippets.

@johnlcox
Created November 15, 2013 23:50
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
Scala Futures
def getNearby(avatarId: UUID, radius: Double) = Action.async {
Avatar.getById(avatarId).flatMap {
case Some(avatar) => avatar.location match {
case Some(location) => AvatarService.findAvatarsNearLocation(location, radius).map {nearby => Ok(Json.toJson(nearby))}
case None => Future.successful(NotFound)
}
case None => Future.successful(NotFound)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment