Created
October 24, 2011 17:19
-
-
Save sheki/1309558 to your computer and use it in GitHub Desktop.
Scala Better way to handle Map NULL.
This file contains hidden or 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
| 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