| Safe Haskell | None |
|---|
Snap.Snaplet.MongoDB.Core
Description
In this module you can find the Snaplet's data type, type class and initializer.
- data MongoDB = MongoDB {}
- class HasMongoDB a where
- getMongoDB :: a -> MongoDB
- type MongoDBPool = Pool IOError Pipe
- mongoDBInit :: Int -> Host -> Database -> SnapletInit app MongoDB
- mongoDBInit' :: Int -> Host -> Database -> AccessMode -> SnapletInit app MongoDB
Documentation
Snaplet's data type.
Usage:
data App = App
{ _heist :: Snaplet (Heist App)
, _database :: Snaplet MongoDB
}
Constructors
| MongoDB | |
Fields | |
class HasMongoDB a whereSource
Snaplet's type-class.
Usage:
instance HasMongoDB App where
getMongoDB app = view snapletValue (view database app)
Methods
getMongoDB :: a -> MongoDBSource
type MongoDBPool = Pool IOError PipeSource
MongoDB Pool type
Arguments
| :: Int | Maximum pool size. |
| -> Host | Host (e.g. return value of MongoDB's host function). |
| -> Database | Database name. |
| -> SnapletInit app MongoDB |
Initializer function.
Usage:
app :: SnapletInit App App
app = makeSnaplet "app" "Example application." Nothing $ do
h <- nestSnaplet "heist" heist $ heistInit "resources/templates"
d <- nestSnaplet "database" database $ mongoDBInit 10 (host "127.0.0.1") "Snaplet-MongoDB"
return $ App h d
Arguments
| :: Int | Maximum pool size. |
| -> Host | Host (e.g. return value of MongoDB's host function). |
| -> Database | Database name. |
| -> AccessMode | Default access mode to be used with this snaplet. |
| -> SnapletInit app MongoDB |
Initializer function.
Usage:
app :: SnapletInit App App
app = makeSnaplet "app" "Example application." Nothing $ do
h <- nestSnaplet "heist" heist $ heistInit "resources/templates"
d <- nestSnaplet "database" database $ mongoDBInit 10 (host "127.0.0.1") "Snaplet-MongoDB"
return $ App h d