-
-
Save anuragsrivastava06/fd224114d7b62a5f72cf1bc91c91ff2a to your computer and use it in GitHub Desktop.
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
package com.knoldus.DAO.user.mappings | |
import com.knoldus.DAO.db.DBComponent | |
import slick.lifted.ProvenShape | |
case class User(id: String = "", name: String, email: String) | |
trait UserMapping { | |
this: DBComponent => | |
import driver.api._ | |
class UserMapping(tag: Tag) extends Table[User](tag, "user") { | |
def id: Rep[String] = column[String]("id", O.PrimaryKey) | |
def name: Rep[String] = column[String]("name") | |
def email: Rep[String] = column[String]("email", O.Unique) | |
def * : ProvenShape[User] = ( | |
id, | |
name, | |
) <> (User.tupled, User.unapply) | |
} | |
val userInfo: TableQuery[UserMapping] = TableQuery[UserMapping] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment