我試圖讓selectOneMany工作取得有限的成功。selectOneMany Yesod持久
我有以下的數據庫模型
User
email Text
verkey Text Maybe
verified Bool
password Text Maybe
UniqueUser email
date UTCTime
deriving Show
Competence
parent CompetenceId Maybe
title Text
UniqueCompetence title
deriving Show Read
UserCompetence
competence CompetenceId
user UserId Eq
UniqueUserCompetence user competence
deriving Show Read
代碼從我的處理程序
mmember <- runMaybeT $ do
id <- MaybeT $ maybeAuth
user <- MaybeT . runDB . get . entityKey $ id
Entity memberId member <- MaybeT . runDB . getBy . UniqueMember . userEmail $ user
competences <- lift . runDB . runJoin $ (selectOneMany (UserCompetenceUser <-.) userCompetenceUser)
return (member,competences)
第一的;我不能讓事件讓這段代碼在沒有添加大型簽名的情況下運行,這是否應該如此?
competences <- lift . runDB . runJoin $ (selectOneMany (UserCompetenceUser <-.) userCompetenceUser :: SelectOneMany SqlPersist (UserGeneric SqlPersist) (UserCompetenceGeneric SqlPersist))
其次;什麼是能力類型。理想情況下,我想結束[實體competencyId能力]。
最後;如何將一個過濾器添加到上面的連接中,以便僅獲取「用戶」的權限?