Created
June 21, 2013 13:36
-
-
Save kristiankime/5831193 to your computer and use it in GitHub Desktop.
This file contains hidden or 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 java.sql.Date | |
| import scala.slick.driver.H2Driver.simple._ // Use H2Driver to connect to an H2 database | |
| import scala.slick.session.Database._ | |
| import scala.slick.jdbc.{ GetResult, StaticQuery => Q } | |
| import com.artclod.h2.WorkingData._ | |
| object ScalaTable extends Table[(Int, String, Date)]("SCALATABLE") { | |
| def COLUMNA = column[Int]("COLUMNA") | |
| def COLUMNB = column[String]("COLUMNB") | |
| def COLUMNC = column[Date]("COLUMNC") | |
| def * = COLUMNA ~ COLUMNB ~ COLUMNC | |
| def inferredColumnData = Vector(InferredColumn("COLUMNA", false, 1, ColumnInt), InferredColumn("COLUMNB", false, 1, ColumnString), InferredColumn("COLUMNC", false, 8, ColumnDate_yyy_MM_dd)) | |
| } | |
| object UsePrintedScalaCodeExample { | |
| def main(args: Array[String]) { | |
| loadCSV("data/data.csv", ScalaTable) | |
| run{Query(ScalaTable) foreach ( println(_) ) } | |
| } | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment