【发布时间】:2013-07-12 20:26:59
【问题描述】:
我正在尝试存储一个整数列表,这就是我正在做的事情:
型号
case class Score(
scoresPerTime: List[Int]
)
object Scores extends Table[Score]("SCORES"){
def scorePerTime = column[List[Int]]("SCORE_PER_TIME")
//...more code
}
控制器
val form = Form(
Map(
"scoresPerTime" -> list(number)
)(Score.apply)(Score.unapply)
)
我得到一个编译错误:
.... could not find implicit value for parameter tm: scala.slick.lifted.TypeMapper[List[Int]][error] def scorePerTime = column[List[Int]]("SCORE_PER_TIME")
如何解决此问题以输入列表?或者尝试其他选项,例如元组、枚举...
【问题讨论】:
-
首先:您想要的可能没有问题。只是为了确定:我假设您想将此
List[Int]保存到单个表列中,例如,作为逗号分隔的字符串或类似字符串。那是对的吗?还是您希望 Slick 生成一个新表,其中包含为您引用的所有List项目? -
@Carsten 我在想 List 中的每个 Int 都会插入到自己的行中。
标签: scala playframework playframework-2.0 slick