snaplet-mongodb-minimalistic-0.0.6.2: Minimalistic MongoDB Snaplet.

Safe HaskellSafe-Infered

Snap.Snaplet.MongoDB.Functions.S

Description

In this module you can find variations of withDB functions.

Functions from this module are to be used when you have single MongoDB snaplet in your application and your application is an instance of HasMongoDB.

Synopsis

Documentation

eitherWithDBSource

Arguments

:: (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.

Database access function.

Usage:

 eitherWithDB $ insert "test-collection" [ "some_field" = "something" ]

eitherWithDB'Source

Arguments

:: (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.

-> m (Either Failure a)

Either Failure or the action's result.

Database access function.

Usage:

 eitherWithDB' UnconfirmedWrites $ insert "test-collection" [ "some_field" = "something" ]

maybeWithDBSource

Arguments

:: (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.

Database access function.

Usage:

 maybeWithDB $ insert "test-collection" [ "some_field" = "something" ]

maybeWithDB'Source

Arguments

:: (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.

-> m (Maybe a)

Nothing in case of failure or Just the result of the action.

Database access function.

Usage:

 maybeWithDB' UnconfirmedWrites $ insert "test-collection" [ "some_field" = "something" ]

unsafeWithDBSource

Arguments

:: (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.

Database access function.

Usage:

 unsafeWithDB $ insert "test-collection" [ "some_field" = "something" ]

unsafeWithDB'Source

Arguments

:: (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.

-> m a

The action's result; in case of failure error is called.

Database access function.

Usage:

 unsafeWithDB' UnconfirmedWrites $ insert "test-collection" [ "some_field" = "something" ]