Created
January 30, 2014 00:36
-
-
Save Mortimerp9/8700331 to your computer and use it in GitHub Desktop.
Store twitter Time in Slick 2 tables.
This file contains 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
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