persistent-audit-0.1.0.3: Parses a Persist Model file and produces Audit Models

Safe HaskellNone
LanguageHaskell2010

Database.Persist.Audit.MongoDB.Util

Synopsis

Documentation

mongoKeyToByteString :: ToBackendKey MongoContext record => Key record -> ByteString Source #

Used for creating instances of ToAudit when the original model database is Mongo and the audit model database is SQL. ==== Example User ident Text password Text Maybe UniqueUser ident UserAudit ident Text password Text Maybe originalId ByteString auditAction AuditAction editedBy Text editedOn UTCTime instance ToAudit User where type AuditResult User = UserAudit toAudit v k auditAction editedBy editedOn = UserAudit (userIdent v) (userPassword v) (mongoKeyToByteString k) auditAction editedBy editedOn

byteStringToMongoKey :: ToBackendKey MongoContext record => ByteString -> Maybe (Key record) Source #

Used for when Mongo stored in SQL needs to be converted to a Key to query the original MongoDB.