当您尝试按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")