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

Safe HaskellNone

Snap.Snaplet.MongoDB.Core

Description

In this module you can find the Snaplet's data type, type class and initializer.

Synopsis

Documentation

data MongoDB Source

Snaplet's data type.

Usage:

 data App = App
     { _heist :: Snaplet (Heist App)
     , _database :: Snaplet MongoDB
     }

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

mongoDBInitSource

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

mongoDBInit'Source

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