Skip to content

Instantly share code, notes, and snippets.

@MaxPresman
Created March 13, 2013 03:21
Show Gist options
  • Select an option

  • Save MaxPresman/5149136 to your computer and use it in GitHub Desktop.

Select an option

Save MaxPresman/5149136 to your computer and use it in GitHub Desktop.
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