Skip to content

Instantly share code, notes, and snippets.

@dhoss
Created May 15, 2015 21:26
Show Gist options
  • Save dhoss/dc6d5caada2e2281ab75 to your computer and use it in GitHub Desktop.
Save dhoss/dc6d5caada2e2281ab75 to your computer and use it in GitHub Desktop.
play 2.4 play-slick model example
package models
import org.joda.time.DateTime
case class Page[A](items: Seq[A], page: Long, offset: Long, total: Long) {
lazy val prev = Option(page - 1).filter(_ >= 0)
lazy val next = Option(page + 1).filter(_ => (offset + items.size) < total)
}
case class Person(id: Long, email: String, password: String, createdAt: Option[DateTime], updatedAt: Option[DateTime])
case class ExerciseType(id: Long, name: String, description: String, createdAt: Option[DateTime], updatedAt: Option[DateTime])
case class Exercise(id: Long, kind: Long, name: String, reps: Option[Long], weight: Option[Long], time: Option[Long], notes: Option[String], person: Long, createdAt: Option[DateTime], updatedAt: Option[DateTime])
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment