Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package models
- // AUTO-GENERATED Slick data model
- /** Stand-alone Slick data model for immediate use */
- object Tables extends {
- val profile = slick.driver.MySQLDriver
- } with Tables
- /** Slick data model trait for extension, choice of backend or usage in the cake pattern. (Make sure to initialize this late.) */
- trait Tables {
- val profile: slick.driver.JdbcProfile
- import profile.api._
- import com.github.tototoshi.slick.MySQLJodaSupport._
- import org.joda.time.DateTime
- import slick.model.ForeignKeyAction
- // NOTE: GetResult mappers for plain SQL are only generated for tables where Slick knows how to map the types of all columns.
- import slick.jdbc.{GetResult => GR}
- /** DDL for all tables. Call .create to execute. */
- lazy val schema: profile.SchemaDescription = User.schema
- @deprecated("Use .schema instead of .ddl", "3.0")
- def ddl = schema
- /** Entity class storing rows of table User
- * @param id Database column id SqlType(BIGINT UNSIGNED), AutoInc, PrimaryKey
- * @param name Database column name SqlType(VARCHAR), Length(255,true), Default(None)
- * @param email Database column email SqlType(VARCHAR), Length(255,true), Default(None)
- * @param password Database column password SqlType(VARCHAR), Length(255,true), Default(None)
- * @param created Database column created SqlType(DATETIME), Default(None)
- * @param updated Database column updated SqlType(DATETIME), Default(None) */
- case class UserRow(id: Long, name: Option[String] = None, email: Option[String] = None, password: Option[String] = None, created: Option[DateTime] = None, updated: Option[DateTime] = None)
- /** GetResult implicit for fetching UserRow objects using plain SQL queries */
- implicit def GetResultUserRow(implicit e0: GR[Long], e1: GR[Option[String]], e2: GR[Option[DateTime]]): GR[UserRow] = GR{
- prs => import prs._
- UserRow.tupled((<<[Long], <<?[String], <<?[String], <<?[String], <<?[DateTime], <<?[DateTime]))
- }
- /** Table description of table User. Objects of this class serve as prototypes for rows in queries. */
- class User(_tableTag: Tag) extends Table[UserRow](_tableTag, "User") {
- def * = (id, name, email, password, created, updated) <> (UserRow.tupled, UserRow.unapply)
- /** Maps whole row to an option. Useful for outer joins. */
- def ? = (Rep.Some(id), name, email, password, created, updated).shaped.<>({r=>import r._; _1.map(_=> UserRow.tupled((_1.get, _2, _3, _4, _5, _6)))}, (_:Any) => throw new Exception("Inserting into ? projection not supported."))
- /** Database column id SqlType(BIGINT UNSIGNED), AutoInc, PrimaryKey */
- val id: Rep[Long] = column[Long]("id", O.AutoInc, O.PrimaryKey)
- /** Database column name SqlType(VARCHAR), Length(255,true), Default(None) */
- val name: Rep[Option[String]] = column[Option[String]]("name", O.Length(255,varying=true), O.Default(None))
- /** Database column email SqlType(VARCHAR), Length(255,true), Default(None) */
- val email: Rep[Option[String]] = column[Option[String]]("email", O.Length(255,varying=true), O.Default(None))
- /** Database column password SqlType(VARCHAR), Length(255,true), Default(None) */
- val password: Rep[Option[String]] = column[Option[String]]("password", O.Length(255,varying=true), O.Default(None))
- /** Database column created SqlType(DATETIME), Default(None) */
- val created: Rep[Option[DateTime]] = column[Option[DateTime]]("created", O.Default(None))
- /** Database column updated SqlType(DATETIME), Default(None) */
- val updated: Rep[Option[DateTime]] = column[Option[DateTime]]("updated", O.Default(None))
- }
- /** Collection-like TableQuery object for table User */
- lazy val User = new TableQuery(tag => new User(tag))
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement