我有以下注释模式:
Table: Comments
Columns: id, post_id, body, user_id, created_at我想获取评论与其各自的帖子和用户。
对一列使用collectionFetchRelated很简单:
comments <- query @Comment
|> fetch
>>= collectionFetchRelated #postId它很容易被称为,
Include "postId" Comment但是如何使用它并调用多列呢?
发布于 2021-12-18 13:48:14
你应该能够做到这一点:
comments :: [Include' ["postId", "userId"] Comment] <- query @Comment
|> fetch
>>= collectionFetchRelated #postId
>>= collectionFetchRelated #userIdInclude' ["postId", "userId"] Comment类型只是Include "userId" (Include "postId" (Comment))的缩写
https://stackoverflow.com/questions/70403802
复制相似问题