我想扩展我的模型的默认$result = $mysqli->query($sql);
实例:
ToJson
我将如何进行:
# models
Event
title Text
content Text
deriving Eq
deriving Show
添加到ToJson 我试图手动定义我的ToJson / FromJson,但是当我这样做时:
id
我收到以下错误:
getEventsR :: Handler Value
getEventsR = do
events <- runDB $ selectList [] [ Desc EventId, LimitTo 5 ] :: Handler [Entity Event]
return $ object ["data" .= events]