我尝试了解一些Slick的作品以及它需要什么.
这是一个例子:
package models
case class Bar(id: Option[Int] = None, name: String)
object Bars extends Table[Bar]("bar") {
def id = column[Int]("id", O.PrimaryKey, O.AutoInc)
// This is the primary key column
def name = column[String]("name")
// Every table needs a * projection with the same type as the table's type parameter
def * = id.? ~ name <>(Bar, Bar.unapply _)
}
Run Code Online (Sandbox Code Playgroud)
有人可以解释一下*这里方法的目的是什么<>,为什么unapply?什么是Projection - 方法~'返回实例Projection2?
并不是说我实际上接近这个限制,但我总是想知道:为什么他们停在Function22/ Tuple22.JVM限制?任意选择?