鉴于此:
import Database.Persist.TH
share [mkPersist sqlSettings { mpsGenerateLenses = True }] [persistLowerCase|
Book json
title String
pages Int
deriving Eq Read Show Generic
|]
我得到这样的JSON:
{ "title": "Persistent book", "pages": 50 }
我可以使用这样的镜头:
book ^. bookTitle
是否可以告诉persistent
自动生成这样的JSON:
{ "_bookTitle": "Persistent book", "_bookPages": 50 }
匹配模特镜头?