Created
March 13, 2013 03:21
-
-
Save MaxPresman/5149136 to your computer and use it in GitHub Desktop.
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
| package models | |
| import anorm._ | |
| import play.api.db.DB | |
| import anorm.SqlParser._ | |
| import play.api.Play.current | |
| case class LogBucket( | |
| id: Int, | |
| label: String, | |
| description: String | |
| ) | |
| object row_definitions { | |
| val log_bucket = { | |
| get[Int]("id") ~ | |
| get[String]("label") ~ | |
| get[String]("description") map { | |
| case id~label~description => LogBucket(id, label,description) | |
| } | |
| } | |
| } | |
| object LogBucket { | |
| def all(): List[LogBucket] = DB.withConnection { implicit conn => | |
| SQL("select * from log_bucket").as(row_definitions.log_bucket *) | |
| } | |
| def create(label: String) {} | |
| def delete(id: Long) {} | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment