我不知道如何用 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
计数grouped by Posts
有小费吗?