Safe Haskell | None |
---|---|
Language | Haskell2010 |
- class ToAudit a where
- type AuditResult a :: *
Documentation
class ToAudit a where Source #
Persistent Model types that have a corresponding Audit type as produced by generateAuditModels
need to implement ToAudit
in order to use the queries
from Queries
. Given the following two Persistent models:
Person name String age Int Maybe PersonAudit name String age Int Maybe originalId PersonId noreference auditAction AuditAction editedBy Text editedOn UTCTime
The ToAudit
instance should look like this:
instance ToAudit Person where type AuditResult Person = PersonAudit toAudit v k auditAction editedBy editedOn = PersonAudit (personName v) (personAge v) k auditAction editedBy editedOn
generateAuditModels
can help automate these instances.
type AuditResult a :: * Source #
toAudit :: a -> Key a -> AuditAction -> Text -> UTCTime -> AuditResult a Source #