如何定义光滑的joinCondition

时间:2013-10-13 07:36:41

标签: scala slick

在scaladays 2013的演讲http://www.parleys.com/play/51c2e20de4b0d38b54f46243/chapter55/agenda中,它谈到了“joinCondition”

例如:

implicit def autojoin1 = joinCondition[Sites,Devices](_.id === _.siteId)
implicit def autojoin2 = joinCondition[Devices,Computers](_.computerId === _.id)
sites.autoJoin(devices).further(computers)
  : Query[_,(Site,Computer)]
sites.autoJoin(devices).autoJoinVia(computers)(_._2)
 : Query[_,((Site,Device),Computer)]

我对scala很新,并且无法弄清楚joinCondition是什么,我找不到任何方法或任何在光滑(1.0.0)中命名的东西并且无法让它工作,什么是它?

2 个答案:

答案 0 :(得分:4)

正如在演讲中所说(但未在幻灯片中列出),Slick目前不提供完整的autoJoin功能,而是我们准备的演示Play项目的一部分。代码在https://github.com/cvogt/play-slick/blob/scaladays2013/samples/computer-database/app/util/autojoin.scala(以及https://github.com/cvogt/play-slick/blob/scaladays2013/samples/computer-database/app/中的其他文件中)

答案 1 :(得分:0)

另请参阅此博客文章,该文章介绍了Slick 2.0 http://tikokelottlegyenviz.blogspot.fr/2013/08/scala-slick-left-join.html

的解决方案