简体   繁体   English

光滑和提升网

[英]Slick and liftweb

As far as I understand latest Slick documentation, there is no straight way to get results immediately from Slick queries, as they always return Future (wrapped, but still). 据我了解最新的Slick文档,没有直接的方法可以立即从Slick查询中获取结果,因为它们总是返回Future(但仍然保留)。

And liftweb requires database results here and now to render the pages. liftweb现在和现在都需要数据库结果来呈现页面。

So, what's the correct way to perform such tasks besides Await.result ? 那么,除了Await.result之外,执行此类任务的正确方法是什么? Let's assume that we are talking about something like "table.list" #> someDbRows.map and not about ajax / comet which seems to be perfectly fit for Futures. 假设我们正在谈论的是诸如"table.list" #> someDbRows.map而不是关于ajax / comet的内容,而后者似乎非常适合于期货。

Thank you. 谢谢。

So, after some investigation, there seems to be no straight way to delegate CssSel answer to Future. 因此,经过一些调查,似乎没有直接的方法将CssSel的委托委托给Future。 The distinct cases are lift comet and lift REST. 不同的情况是彗星升空和REST升空。 So, the only way to use Slick in a direct CssSel request is to Await.result with reasonable timings. 因此,在直接CssSel请求中使用Slick的唯一方法是在合理的时间安排Await.result

Update : still, there is a way to use Futures in a righthand expression part and more in Lift 3.0 changes , thanks to Antonio Salazar Cardozo 更新 :仍然有一种方法可以在右侧表达部分中使用期货,并且在Lift 3.0更改中可以使用期货 ,这要归功于Antonio Salazar Cardozo

There is a similar questions here: Background task in Liftweb environment and brief explanation https://groups.google.com/forum/#!topic/liftweb/zlNmSeboOGc 这里有一个类似的问题: Liftweb环境中的后台任务和简要说明https://groups.google.com/forum/#!topic/liftweb/zlNmSeboOGc

PS: Dear SO community, please stop farming reputation providing unrelated answers from top 3 google and raging when they gets down voted. PS:亲爱的SO社区,请停止提供前3名Google无关的答案的农业声誉,并在他们投票失败后大怒。 I understand that SO slowly became HR hiring platform, but this is not why SO exists. 我知道SO逐渐成为人力资源招聘平台,但这不是SO存在的原因。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM