persistent-template 2.1.3.6 → 2.1.3.7
raw patch · 2 files changed
+9/−8 lines, 2 filesdep +aeson-extradep ~aesonPVP ok
version bump matches the API change (PVP)
Dependencies added: aeson-extra
Dependency ranges changed: aeson
API changes (from Hackage documentation)
Files
- Database/Persist/TH.hs +6/−6
- persistent-template.cabal +3/−2
Database/Persist/TH.hs view
@@ -63,7 +63,7 @@ import Text.Read (readPrec, lexP, step, prec, parens, Lexeme(Ident)) import qualified Data.Map as M import qualified Data.HashMap.Strict as HM-import Data.Aeson+import Data.Aeson.Compat ( ToJSON (toJSON), FromJSON (parseJSON), (.=), object , Value (Object), (.:), (.:?) , eitherDecodeStrict'@@ -914,7 +914,7 @@ fkc <- mapM (mkForeignKeysComposite mps t) $ entityForeigns t let primaryField = entityId t- + fields <- mapM (mkField mps t) $ primaryField : entityFields t toFieldNames <- mkToFieldNames $ entityUniques t @@ -1036,12 +1036,12 @@ let reftableKeyName = mkName $ reftableString `mappend` "Key" let tablename = mkName $ unpack $ entityText t recordName <- newName "record"- + let fldsE = map (\((foreignName, _),_) -> VarE (fieldName $ foreignName) `AppE` VarE recordName) foreignFields let mkKeyE = foldl' AppE (maybeExp foreignNullable $ ConE reftableKeyName) fldsE let fn = FunD fname [normalClause [VarP recordName] mkKeyE]- + let t2 = maybeTyp foreignNullable $ ConT ''Key `AppT` ConT (mkName reftableString) let sig = SigD fname $ (ArrowT `AppT` (ConT tablename)) `AppT` t2 return [sig, fn]@@ -1060,7 +1060,7 @@ -- @ -- instance PersistEntity e => PersistField e where -- toPersistValue = PersistMap $ zip columNames (map toPersistValue . toPersistFields)--- fromPersistValue (PersistMap o) = +-- fromPersistValue (PersistMap o) = -- let columns = HM.fromList o -- in fromPersistValues $ map (\name -> -- case HM.lookup name columns of@@ -1266,7 +1266,7 @@ -- | Automatically creates a valid 'PersistField' instance for any datatype -- that has valid 'ToJSON' and 'FromJSON' instances. For a datatype @T@ it -- generates instances similar to these:--- +-- -- @ -- instance PersistField T where -- toPersistValue = PersistByteString . L.toStrict . encode
persistent-template.cabal view
@@ -1,5 +1,5 @@ name: persistent-template-version: 2.1.3.6+version: 2.1.3.7 license: MIT license-file: LICENSE author: Michael Snoyman <michael@snoyman.com>@@ -23,7 +23,8 @@ , text >= 0.5 , transformers >= 0.2 && < 0.5 , containers- , aeson >= 0.7 && < 0.10+ , aeson >= 0.7 && < 0.11+ , aeson-extra >= 0.2.1.0 && < 0.3 , monad-logger , unordered-containers , tagged