Skip to content

Instantly share code, notes, and snippets.

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

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

Select an option

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

Revisions

  1. MaxPresman created this gist Mar 13, 2013.
    37 changes: 37 additions & 0 deletions gistfile1.scala
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,37 @@
    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) {}

    }