packages feed

snaplet-mongodb-minimalistic 0.0.6 → 0.0.6.1

raw patch · 4 files changed

+29/−26 lines, 4 filesdep ~mongoDB

Dependency ranges changed: mongoDB

Files

snaplet-mongodb-minimalistic.cabal view
@@ -1,5 +1,5 @@ Name:               snaplet-mongodb-minimalistic-Version:            0.0.6+Version:            0.0.6.1 Synopsis:           Minimalistic MongoDB Snaplet. Description:        Minimalistic MongoDB Snaplet. License:            BSD3@@ -38,6 +38,6 @@     snap                        == 0.7.*,     snap-core                   == 0.7.*,     text                        >= 0.11 && < 0.12,-    mongoDB                     >= 1.1.1 && < 1.2.0+    mongoDB                     >= 1.2 && < 1.3  
src/Snap/Snaplet/MongoDB/Core.hs view
@@ -12,10 +12,10 @@  import           Data.Text (Text) -import           Snap+import           Snap (SnapletInit, liftIO, makeSnaplet) -import           Database.MongoDB-import           System.IO.Pool+import           Database.MongoDB (Database, Host, Pipe, AccessMode (UnconfirmedWrites), close, isClosed, connect)+import           System.IO.Pool (Pool, Factory (Factory), newPool)  ------------------------------------------------------------------------------ @@ -47,7 +47,6 @@ -- | Snaplet's type-class. -- -- Usage:--- -- -- > instance HasMongoDB App where -- >     getMongoDB = getL (snapletValue . database)
src/Snap/Snaplet/MongoDB/Functions/M.hs view
@@ -14,13 +14,15 @@ , unsafeWithDB' ) where  -import           Control.Monad.Error+import           Control.Monad.Error (runErrorT) -import           Snap+import           Snap (MonadIO, MonadState, gets, liftIO) -- transformers, mtl+import           Snap (Lens, getL) -- data-lens+import           Snap (Snaplet, snapletValue) import           Snap.Snaplet.MongoDB.Core -import           Database.MongoDB-import           System.IO.Pool+import           Database.MongoDB (Action, AccessMode, Failure (ConnectionFailure), access)+import           System.IO.Pool (aResource)  import qualified Control.Category as C ((.)) @@ -29,7 +31,7 @@ -- -- Example: ----- > unsafeWithDB accountDB $ insert "test-collection" ["some_field" = "something" ]+-- > unsafeWithDB accountDB $ insert "test-collection" [ "some_field" = "something" ] unsafeWithDB :: (MonadIO m, MonadState app m)              => Lens app (Snaplet MongoDB) -- ^ The snaplet (database) on which you want the action to be run.              -> Action IO a                -- ^ 'Action' you want to perform.@@ -41,7 +43,7 @@ -- -- Example: ----- > unsafeWithDB' accountDB UnconfirmedWrites $ insert "test-collection" ["some_field" = "something" ]+-- > unsafeWithDB' accountDB UnconfirmedWrites $ insert "test-collection" [ "some_field" = "something" ] unsafeWithDB' :: (MonadIO m, MonadState app m)               => Lens app (Snaplet MongoDB) -- ^ The snaplet (database) on which you want the action to be run.               -> AccessMode                 -- ^ Access mode you want to use when performing the action.@@ -56,7 +58,7 @@ -- -- Example: ----- > maybeWithDB accountDB $ insert "test-collection" ["some_field" = "something" ]+-- > maybeWithDB accountDB $ insert "test-collection" [ "some_field" = "something" ] maybeWithDB :: (MonadIO m, MonadState app m)             => Lens app (Snaplet MongoDB) -- ^ The snaplet (database) on which you want the action to be run.             -> Action IO a                -- ^ 'Action' you want to perform.@@ -68,7 +70,7 @@ -- -- Example: ----- > maybeWithDB' accountDB UnconfirmedWrites $ insert "test-collection" ["some_field" = "something" ]+-- > maybeWithDB' accountDB UnconfirmedWrites $ insert "test-collection" [ "some_field" = "something" ] maybeWithDB' :: (MonadIO m, MonadState app m)              => Lens app (Snaplet MongoDB) -- ^ The snaplet (database) on which you want the action to be run.              -> AccessMode                 -- ^ Access mode you want to use when performing the action.@@ -83,7 +85,7 @@ -- -- Example: ----- > eitherWithDB accountDB $ insert "test-collection" ["some_field" = "something" ]+-- > eitherWithDB accountDB $ insert "test-collection" [ "some_field" = "something" ] eitherWithDB :: (MonadIO m, MonadState app m)              => Lens app (Snaplet MongoDB) -- ^ The snaplet (database) on which you want the action to be run.              -> Action IO a                -- ^ 'Action' you want to perform.@@ -95,7 +97,7 @@ -- -- Example: ----- > eitherWithDB' accountDB UnconfirmedWrites $ insert "test-collection" ["some_field" = "something" ]+-- > eitherWithDB' accountDB UnconfirmedWrites $ insert "test-collection" [ "some_field" = "something" ] eitherWithDB' :: (MonadIO m, MonadState app m)               => Lens app (Snaplet MongoDB) -- ^ The snaplet (database) on which you want the action to be run.               -> AccessMode                 -- ^ Access mode you want to use when performing the action.
src/Snap/Snaplet/MongoDB/Functions/S.hs view
@@ -14,20 +14,22 @@ , unsafeWithDB' ) where -import           Control.Monad.Error+import           Control.Monad.Error (runErrorT) -import           Snap+import           Snap (MonadIO, MonadState, gets, liftIO) -- transformers, mtl+import           Snap (Lens, getL) -- data-lens+import           Snap (Snaplet, snapletValue) import           Snap.Snaplet.MongoDB.Core -import           Database.MongoDB-import           System.IO.Pool+import           Database.MongoDB (Action, AccessMode, Failure (ConnectionFailure), access)+import           System.IO.Pool (aResource)  ------------------------------------------------------------------------------ -- | Database access function. -- -- Usage: ----- > unsafeWithDB $ insert "test-collection" ["some_field" = "something" ]+-- > unsafeWithDB $ insert "test-collection" [ "some_field" = "something" ] unsafeWithDB :: (MonadIO m, MonadState app m, HasMongoDB app)              => Action IO a         -- ^ 'Action' you want to perform.              -> m a                 -- ^ The action's result; in case of failure 'error' is called.@@ -38,7 +40,7 @@ -- -- Usage: ----- > unsafeWithDB' UnconfirmedWrites $ insert "test-collection" ["some_field" = "something" ]+-- > unsafeWithDB' UnconfirmedWrites $ insert "test-collection" [ "some_field" = "something" ] unsafeWithDB' :: (MonadIO m, MonadState app m, HasMongoDB app)               => AccessMode             -- ^ Access mode you want to use when performing the action.               -> Action IO a            -- ^ 'Action' you want to perform.@@ -52,7 +54,7 @@ -- -- Usage: ----- > maybeWithDB $ insert "test-collection" ["some_field" = "something" ]+-- > maybeWithDB $ insert "test-collection" [ "some_field" = "something" ] maybeWithDB :: (MonadIO m, MonadState app m, HasMongoDB app)             => Action IO a          -- ^ 'Action' you want to perform.             -> m (Maybe a)          -- ^ 'Nothing' in case of failure or 'Just' the result of the action.@@ -63,7 +65,7 @@ -- -- Usage: ----- > maybeWithDB' UnconfirmedWrites $ insert "test-collection" ["some_field" = "something" ]+-- > maybeWithDB' UnconfirmedWrites $ insert "test-collection" [ "some_field" = "something" ] maybeWithDB' :: (MonadIO m, MonadState app m, HasMongoDB app)              => AccessMode          -- ^ Access mode you want to use when performing the action.              -> Action IO a         -- ^ 'Action' you want to perform.@@ -77,7 +79,7 @@ -- -- Usage: ----- > eitherWithDB $ insert "test-collection" ["some_field" = "something" ]+-- > eitherWithDB $ insert "test-collection" [ "some_field" = "something" ] eitherWithDB :: (MonadIO m, MonadState app m, HasMongoDB app)              => Action IO a             -- ^ 'Action' you want to perform.              -> m (Either Failure a)    -- ^ 'Either' 'Failure' or the action's result.@@ -88,7 +90,7 @@ -- -- Usage: ----- > eitherWithDB' UnconfirmedWrites $ insert "test-collection" ["some_field" = "something" ]+-- > eitherWithDB' UnconfirmedWrites $ insert "test-collection" [ "some_field" = "something" ] eitherWithDB' :: (MonadIO m, MonadState app m, HasMongoDB app)               => AccessMode             -- ^ Access mode you want to use when performing the action.               -> Action IO a            -- ^ 'Action' you want to perform.