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

Snap.Snaplet.MongoDB.Functions.M

Description

In this module you can find variations of withDB functions.

Functions from this module are to be used when you have multiple MongoDB snaplets (databases) in your application.

Synopsis

Documentation

eitherWithDBSource

Arguments

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

-> m (Either Failure a)

Either Failure or the action's result.

Database access function.

Example:

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

eitherWithDB'Source

Arguments

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

-> Action IO a

Action you want to perform.

-> m (Either Failure a)

Either Failure or the action's result.

Database access function.

Example:

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

maybeWithDBSource

Arguments

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

-> m (Maybe a)

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

Database access function.

Example:

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

maybeWithDB'Source

Arguments

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

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

Example:

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

unsafeWithDBSource

Arguments

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

-> m a

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

Database access function.

Example:

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

unsafeWithDB'Source

Arguments

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

-> Action IO a

Action you want to perform.

-> m a

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

Database access function.

Example:

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