I'm working on migrating to slick 2 but I've come across a class that I can't seem to find anywhere.
我正在努力迁移到光滑2但我遇到了一个我似乎无法在任何地方找到的课程。
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.
在Table的定义中,它表示Tag的类型为Option [String],但是在我正在阅读的教程中,它只使用了一种Tag。我正在寻找这个来自哪个包。
1 个解决方案
#1
9
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]
.
检查表的定义我们可以看到它的类型为Tag:表定义不知道你在哪里读或发现它的类型为Option [String]。
Clicking on Tag
brings up the Tag definition: Tag definition
单击Tag可显示标记定义:标记定义
So to answer your question it's coming from the scala.slick.lifted
package.
所以要回答你的问题,它来自scala.slick.lifted包。
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.
您不需要实际创建标记,因为您使用val suppliers = TableQuery [Suppliers]构造进行查询,该构造负责处理所有与Tag相关的内容。
#1
9
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]
.
检查表的定义我们可以看到它的类型为Tag:表定义不知道你在哪里读或发现它的类型为Option [String]。
Clicking on Tag
brings up the Tag definition: Tag definition
单击Tag可显示标记定义:标记定义
So to answer your question it's coming from the scala.slick.lifted
package.
所以要回答你的问题,它来自scala.slick.lifted包。
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.
您不需要实际创建标记,因为您使用val suppliers = TableQuery [Suppliers]构造进行查询,该构造负责处理所有与Tag相关的内容。