Created
January 17, 2011 18:57
-
-
Save jonifreeman/783266 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
case class Book(title: String, date: Date, author: String) | |
val someDate = new Date | |
/* Would be nice to return String, PreparedStmt or something instead of Dynamic | |
val books: Dynamic[String] = Book | |
val q1 = books.findByTitle("The Stand") | |
val q2 = books.findByTitleLike("Harry Pot%") | |
val q3 = books.findByDateGreaterThan(someDate) | |
*/ | |
// This works but explicit call to typed is verbose | |
val books: Dynamic = Book | |
val q1 = books.findByTitle("The Stand").typed[String] | |
val q2 = books.findByTitleLike("Harry Pot%").typed[String] | |
val q3 = books.findByDateGreaterThan(someDate).typed[String] | |
assert(q1 == "select title,date,author from book where title='The Stand'") | |
assert(q2 == "select title,date,author from book where title like 'Harry Pot%'") | |
assert(q3 == "select title,date,author from book where date > '" + someDate + "'") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment