0
誰能告訴我,爲什麼在這種情況下:油滑表查詢:問題與認識價值
Query(Users) foreach {case (userId, userName) =>
println(userId + ", " + userName) }
斯卡拉識別用戶id,但在這種情況下:
val l = List[(Int, String)]()
Query(Users) foreach {
case (userId, userName) =>
l::(foo(List[(userId, userName)]))
}
它不? (如在上的「=>」右側的用戶id在第二種情況下被識別而不是第一)
用戶是一個圓滑裝數據庫,看起來像這樣:
object Users extends Table[(Int, String)]("Users") {
def userId = column[Int]("UserId", O.PrimaryKey, O.AutoInc)
def userName = column[String]("UserName")
def * = userId ~ userName
}
謝謝cmbaxter!你還可以看看這個後續問題嗎? http://stackoverflow.com/questions/17662215/slick-working-with-columnint-values –