Created
June 21, 2012 21:16
-
-
Save nicmarti/2968582 to your computer and use it in GitHub Desktop.
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 getJobsSinceWithPattern(someday: DateTime, msgPattern: String): List[Log] = DB.withConnection{ | |
implicit c=> | |
val sql = SQL("""|SELECT log_date, category, level, message, error, source FROM logs | |
|WHERE log_date >={day} | |
|AND message like {msg} | |
""".stripMargin) | |
.on("day" -> someday.toString("yyyy-MM-dd")).on("msg" -> msgPattern) | |
val listParsed=sql.as(date("log_date") ~ str("category") ~ str("level") ~ str("message") ~ get[Option[String]]("error") ~ str("source") map flatten *) | |
listParsed.map{ it=> Log(new DateTime(it._1), it._2, it._3, it._4, it._5, it._6) } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment