Skip to content

Instantly share code, notes, and snippets.

@sheki
Created October 24, 2011 17:19
Show Gist options
  • Select an option

  • Save sheki/1309558 to your computer and use it in GitHub Desktop.

Select an option

Save sheki/1309558 to your computer and use it in GitHub Desktop.
Scala Better way to handle Map NULL.
object Host {
def configForHost(host: String): String = {
val resultMap = template.queryForMap("SELECT config FROM host WHERE NAME = ?", host)
resultMap.get("config").toString
}
}
ApiServlet {
get("/config/host/:host") {
val host = params("host")
val hostConfig = Host.configForHost(host)
val allTags = Host.allTagConfig(host)
mergeJson(hostConfig, allTags)
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment