scala slick Methode, die ich nicht verstehen kann, so weit

Ich versuche zu verstehen, einige Slick funktioniert und was es erfordert.

Hier ein Beispiel:

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 _)
}

Könnte jemand mir erklären, was der Zweck der * Methode hier, was ist <>warum unapply? und was ist Projektion - Methode ~' gibt die Instanz von Projection2?

InformationsquelleAutor der Frage ses | 2012-12-16

Schreibe einen Kommentar