packages feed

persistent-template 1.2.0.1 → 1.2.0.2

raw patch · 2 files changed

+12/−5 lines, 2 filesPVP ok

version bump matches the API change (PVP)

API changes (from Hackage documentation)

Files

Database/Persist/TH.hs view
@@ -159,7 +159,8 @@ fixEntityDef ed =     ed { entityFields = filter keepField $ entityFields ed }   where-    keepField fd = "MigrationOnly" `notElem` fieldAttrs fd+    keepField fd = "MigrationOnly" `notElem` fieldAttrs fd &&+                   "SafeToRemove" `notElem` fieldAttrs fd  -- | Settings to be passed to the 'mkPersist' function. data MkPersistSettings = MkPersistSettings@@ -429,8 +430,8 @@     nothing <- [|Left $(liftT $ "Invalid fromPersistValues input. Entity: " `mappend` entName)|]     let cons' = ConE $ mkName $ unpack $ entName     xs <- mapM (const $ newName "x") $ entityFields t-    fs <- [|fromPersistValue|]-    let xs' = map (AppE fs . VarE) xs+    mkPersistValues <- mapM (mkPersistValue . unHaskellName . fieldHaskell) $ entityFields t+    let xs' = map (\(pv, x) -> pv `AppE` VarE x) $ zip mkPersistValues xs     let pat = ListP $ map VarP xs     ap' <- [|(<*>)|]     just <- [|Right|]@@ -440,6 +441,12 @@         , Clause [WildP] (NormalB nothing) []         ]   where+    mkPersistValue fieldName = [|\persistValue ->+            case fromPersistValue persistValue of+                   Right r  -> Right r+                   Left err -> Left $+                     "field " `mappend` $(liftT fieldName) `mappend` ": " `mappend` err+          |]     entName = unHaskellName $ entityHaskell t     go ap' x y = InfixE (Just x) ap' (Just y) @@ -643,7 +650,7 @@ mkSave name' defs' = do     let name = mkName name'     defs <- lift defs'-    return [ SigD name $ ListT `AppT` ConT ''EntityDef+    return [ SigD name $ ListT `AppT` (ConT ''EntityDef `AppT` ConT ''SqlType)            , FunD name [Clause [] (NormalB defs) []]            ] 
persistent-template.cabal view
@@ -1,5 +1,5 @@ name:            persistent-template-version:         1.2.0.1+version:         1.2.0.2 license:         MIT license-file:    LICENSE author:          Michael Snoyman <michael@snoyman.com>