在 Table 中,只有一个值元组不起作用的精巧配置
In Table for slick configuration where are only one value tuple doesn't work
当我有 2 个或更多参数时 - 它有效,但 当我有 1 个 - 它无法编译。
我知道,元组用于 2 个或更多参数函数。
但是,如果我不想 table 只有一个值?
case class Some(name: String)
class SomeTable(tag: Tag) extends Table[Some](tag, "Some") {
def name = column[String]("SomeNAME", O.PrimaryKey)
override def * = name <>(Some.tupled, Some.unapply)
}
我们可以用
替换覆盖
override def * = name <>(Some.apply, Some.unapply)
对我有用。
当我有 2 个或更多参数时 - 它有效,但 当我有 1 个 - 它无法编译。 我知道,元组用于 2 个或更多参数函数。 但是,如果我不想 table 只有一个值?
case class Some(name: String)
class SomeTable(tag: Tag) extends Table[Some](tag, "Some") {
def name = column[String]("SomeNAME", O.PrimaryKey)
override def * = name <>(Some.tupled, Some.unapply)
}
我们可以用
替换覆盖override def * = name <>(Some.apply, Some.unapply)
对我有用。