【发布时间】:2015-08-06 10:52:07
【问题描述】:
我不知道如何用 Slick (3) 计数。
val posts = for {
p <- Posts.query if p.receiver === userId
comments <- Comments.query if comments.postId === p.id
author <- Users.query if p.author === author.id
receiver <- Users.query if p.receiver === receiver.id
} yield (p, comments, author, receiver)
具有以下关系
Posts : Author : Receiver : Comments
1 : 1 : 1 : N
结果应该是:
Future[Seq[(Post, User, User, Int)]]
int 是 cmets grouped by Posts 的计数
有什么建议吗?
【问题讨论】: