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

Safe HaskellSafe-Infered

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 app whereSource

Snaplet's type-class.

Usage:

 instance HasMongoDB App where
     getMongoDB = getL (snapletValue . database)

Note: The (.) is from Category.

Methods

getMongoDB :: app -> 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