如何从 Slick 中的无参数编译查询中提取 SQL 查询

问题描述

这是标题中问题的示例。

我有这个查询

tableQuery
      .filter(_.removedAt.isEmpty)
      .filter(r => r.appRoleId inSet appRolesSeq)
      .filter(r => !(r.appRoleId inSet existingRoles.map(_.appRoleId)))
      .result

我想重构以使用这样的编译查询

lazy val findAppRoles = Compiled(
  () => tableQuery.filter(_.removedAt.isEmpty)
)

findAppRoles.extract()
      .filter(r => r.appRoleId inSet appRolesSeq)
      .filter(r => !(r.appRoleId inSet existingRoles.map(_.appRoleId)))
      .result

这显然不起作用,因为 .extract() 无法解析,那么有什么方法可以做到这一点?

解决方法

暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!

如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。

小编邮箱:dio#foxmail.com (将#修改为@)