Skip to content

Instantly share code, notes, and snippets.

@Mortimerp9
Created January 30, 2014 00:36
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Mortimerp9/8700331 to your computer and use it in GitHub Desktop.
Save Mortimerp9/8700331 to your computer and use it in GitHub Desktop.
Store twitter Time in Slick 2 tables.
import scala.slick.driver....simple._
import com.twitter.util.Time
class TimeTable(tag: Tag) extends Table[(Int, Time)](tag, "timetable") {
implicit val twitterTimeMap = MappedColumnType.base[Time, Long](
{ time => time.inMillis },
{ millis => Time.fromMilliseconds(millis) }
)
def id = column[Int]("id", O.PrimaryKey, O.AutoInc)
def time = column[Time]("time")
def * = (id, time)
}
val timeTable = TableQuery[TimeTable]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment