I'm working on migrating to slick 2 but I've come across a class that I can't seem to find anywhere.
package learningSlick
import scala.slick.driver.MySQLDriver.simple._
case class Supplier( snum: String, sname: String, status: Int, city: String )
class Suppliers(tag: Option[String]) extends Table[Supplier](tag, "suppliers") {
def snum = column[String]("snum")
def sname = column[String]("sname")
def status = column[Int]("status")
def city = column[String]("city")
def * = snum ~ sname ~ status ~ city <> (Supplier, Supplier.unapply _)
}
The following is the code from the tutorial:
import scala.slick.driver.PostgresDriver.simple._
class Suppliers(tag: Tag) extends Table[(String, String, Int, String)](tag, "suppliers") {
def snum = column[String]("snum")
def sname = column[String]("sname")
def status = column[Int]("status")
def city = column[String]("city")
def * = (snum, sname, status, city)
}
In the definition for Table it says that the Tag is of type Option[String] however in a tutorial I'm going through it just uses a type of Tag. I'm looking for which package this is coming from.
Checking the definition of Table we can see that it's of type Tag
: Table definition Don't know where you read or found that it's of type Option[String]
.
Clicking on Tag
brings up the Tag definition: Tag definition
So to answer your question it's coming from the scala.slick.lifted
package.
You won't be needing to actually create a Tag
, because you query with the val suppliers = TableQuery[Suppliers]
construct, which takes care of all the Tag
related stuff.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With