通过映射的colum进行光滑查询

时间:2016-07-07 21:47:50

标签: scala slick

当您尝试按MappedTo[Long]进行查询时:

for {
  game <- GamblrGame.table
  bet <- GamblrBet.table if game.id === bet.game
} yield (game, bet)

你得到:

[error] /Volumes/Home/dev/gamblr/test/BotTest.scala:27: Cannot perform option-mapped operation
[error]       with type: (slicky.Slicky.ID, slicky.fields.FK[models.GamblrGame]) => R
[error]   for base type: (slicky.Slicky.ID, slicky.Slicky.ID) => Boolean
[error]         bet <- GamblrBet.table if game.id === bet.game

我应该如何在查询中使用映射列?

FK

case class FK[E <: IdEntity[E]](id: ID)(implicit tag: TypeTag[E])
  extends MappedTo[Long]

game中的GamblrBet.table列:

def game = column[FK[GamblrGame]]("GAME")

0 个答案:

没有答案