Yesod数据库持久记录访问

时间:2017-07-13 00:28:41

标签: haskell yesod

以下是models文件

UserSetting
    source ArticleSourceId
    minimumShouldMatch Int 
    articleLength Int
    userId UserId
    deriving Show

在我的处理程序中,我发现我无法在实体值source上使用vVal

   (v:_) <- selectList [UserSettingUserId ==. asUd] [LimitTo 1]
   let vVal = source $ entityVal v
   let vId = entityKey v

错误讯息为Variable not in scope: source :: UserSetting -> Integer

1 个答案:

答案 0 :(得分:3)

这将有效:

let vVal = userSettingSource $ entityVal v