【发布时间】:2013-06-19 18:22:21
【问题描述】:
我正在通过以下 URL 阅读教程:http://www.smartjava.org/content/tutorial-getting-started-scala-and-scalatra-part-iii
这是一段代码:
class BidRepository extends RepositoryBase {
object BidMapping extends Table[(Option[Long], Long, Double, Double, String, Long, Long)]("sc_bid") {
def id = column[Option[Long]]("id", O PrimaryKey)
def forItem = column[Long]("for", O NotNull)
def min = column[Double]("min", O NotNull)
def max = column[Double]("max", O NotNull)
def currency = column[String]("currency")
def bidder = column[Long]("bidder", O NotNull)
def date = column[Long]("date", O NotNull)
def noID = forItem ~ min ~ max ~ currency ~ bidder ~ date
def * = id ~ forItem ~ min ~ max ~ currency ~ bidder ~ date
}
我没能理解的是~ 在这里被用来做什么?调用 noID 和 * 方法时究竟发生了什么?这里是否有足够的上下文可以理解,或者~ 是我在某处看不到的一些隐含价值?
【问题讨论】: