persistent-mongoDB 2.11.0.0 → 2.12.0.0
raw patch · 3 files changed
+16/−13 lines, 3 filesdep −persistent-templatedep ~persistentPVP ok
version bump matches the API change (PVP)
Dependencies removed: persistent-template
Dependency ranges changed: persistent
API changes (from Hackage documentation)
Files
- ChangeLog.md +4/−0
- Database/Persist/MongoDB.hs +10/−10
- persistent-mongoDB.cabal +2/−3
ChangeLog.md view
@@ -1,5 +1,9 @@ # Changelog for persistent-mongoDB +## 2.12.0.0++* Decomposed `HaskellName` into `ConstraintNameHS`, `EntityNameHS`, `FieldNameHS`. Decomposed `DBName` into `ConstraintNameDB`, `EntityNameDB`, `FieldNameDB` respectively. [#1174](https://github.com/yesodweb/persistent/pull/1174)+ ## 2.11.0 * Naive implementation of `exists` function from `PersistQueryRead` type class using `count`. [#1131](https://github.com/yesodweb/persistent/pull/1131/files)
Database/Persist/MongoDB.hs view
@@ -408,7 +408,7 @@ -- | convert a unique key into a MongoDB document toUniquesDoc :: forall record. (PersistEntity record) => Unique record -> [DB.Field] toUniquesDoc uniq = zipWith (DB.:=)- (map (unDBName . snd) $ persistUniqueToFieldNames uniq)+ (map (unFieldNameDB . snd) $ persistUniqueToFieldNames uniq) (map DB.val (persistUniqueToValues uniq)) -- | convert a PersistEntity into document fields.@@ -448,7 +448,7 @@ collectionName :: (PersistEntity record, PersistEntityBackend record ~ DB.MongoContext) => record -> Text-collectionName = unDBName . entityDB . entityDef . Just+collectionName = unEntityNameDB . entityDB . entityDef . Just -- | convert a PersistEntity into document fields. -- unlike 'toInsertDoc', nulls are included.@@ -463,15 +463,15 @@ documentFromEntity (Entity key record) = keyToMongoDoc key ++ recordToDocument record -zipToDoc :: PersistField a => [DBName] -> [a] -> [DB.Field]+zipToDoc :: PersistField a => [FieldNameDB] -> [a] -> [DB.Field] zipToDoc [] _ = [] zipToDoc _ [] = [] zipToDoc (e:efields) (p:pfields) = let pv = toPersistValue p- in (unDBName e DB.:= DB.val pv):zipToDoc efields pfields+ in (unFieldNameDB e DB.:= DB.val pv):zipToDoc efields pfields fieldToLabel :: EmbedFieldDef -> Text-fieldToLabel = unDBName . emFieldDB+fieldToLabel = unFieldNameDB . emFieldDB keyFrom_idEx :: (Trans.MonadIO m, PersistEntity record) => DB.Value -> m (Key record) keyFrom_idEx idVal = case keyFrom_id idVal of@@ -643,7 +643,7 @@ keyToMongoDoc :: (PersistEntity record, PersistEntityBackend record ~ DB.MongoContext) => Key record -> DB.Document keyToMongoDoc k = case entityPrimary $ entityDefFromKey k of- Nothing -> zipToDoc [DBName id_] values+ Nothing -> zipToDoc [FieldNameDB id_] values Just pdef -> [id_ DB.=: zipToDoc (primaryNames pdef) values] where primaryNames = map fieldDB . compositeFields@@ -661,7 +661,7 @@ map toField (entityFields eDef) where toField :: FieldDef -> DB.Field- toField fDef = (unDBName (fieldDB fDef)) DB.=: (1 :: Int)+ toField fDef = (unFieldNameDB (fieldDB fDef)) DB.=: (1 :: Int) projectionFromKey :: PersistEntity record => Key record -> DB.Projector projectionFromKey = projectionFromEntityDef . entityDefFromKey@@ -896,8 +896,8 @@ FilterValues vs -> DB.val $ map toPersistValue vs fieldName :: forall record typ. (PersistEntity record) => EntityField record typ -> DB.Label-fieldName f | fieldHaskell fd == HaskellName "Id" = id_- | otherwise = unDBName $ fieldDB $ fd+fieldName f | fieldHaskell fd == FieldNameHS "Id" = id_+ | otherwise = unFieldNameDB $ fieldDB $ fd where fd = persistFieldDef f @@ -920,7 +920,7 @@ fromPersistValuesThrow entDef doc = case eitherFromPersistValues entDef doc of Left t -> Trans.liftIO . throwIO $ PersistMarshalError $- unHaskellName (entityHaskell entDef) `mappend` ": " `mappend` t+ unEntityNameHS (entityHaskell entDef) `mappend` ": " `mappend` t Right entity -> return entity mapLeft :: (a -> c) -> Either a b -> Either c b
persistent-mongoDB.cabal view
@@ -1,5 +1,5 @@ name: persistent-mongoDB-version: 2.11.0.0+version: 2.12.0.0 license: MIT license-file: LICENSE author: Greg Weber <greg@gregweber.info>@@ -20,7 +20,7 @@ library build-depends: base >= 4.8 && < 5- , persistent >= 2.8 && < 3+ , persistent >= 2.12 && < 3 , aeson >= 1.0 , bson >= 0.3.2 && < 0.5 , bytestring@@ -58,7 +58,6 @@ , persistent , persistent-mongoDB , persistent-qq- , persistent-template , persistent-test , blaze-html , bytestring