Copyright | (C) 2014 Samuli Thomasson |
---|---|
License | MIT (see the file LICENSE) |
Maintainer | Samuli Thomasson <samuli.thomasson@paivola.fi> |
Stability | experimental |
Portability | non-portable |
Safe Haskell | None |
Language | Haskell2010 |
ZabbixDB
Description
Habbix
is the context in which we operate. Provides IO
and two
database connections via runLocalDB
and runRemoteDB
.
- data Habbix a
- runHabbix :: Bool -> Bool -> FilePath -> ConnectionString -> ConnectionString -> Habbix a -> IO a
- type ConnectionString = ByteString
- type DB = SqlPersistT Habbix
- runLocalDB :: DB a -> Habbix a
- runRemoteDB :: SqlPersistT Habbix a -> Habbix a
- module Models
- module ZabbixModels
- modelsDir :: HabbixState -> FilePath
- type Epoch = Int
- tshow :: Show a => a -> Text
- asks :: MonadReader r m => (r -> a) -> m a
Documentation
data Habbix a
runHabbix :: Bool -> Bool -> FilePath -> ConnectionString -> ConnectionString -> Habbix a -> IO a
runHabbix debugsql local remote action
type ConnectionString = ByteString
A libpq
connection string. A simple example of connection
string would be "host=localhost port=5432 user=test
dbname=test password=test"
. Please read libpq's
documentation at
http://www.postgresql.org/docs/9.1/static/libpq-connect.html
for more details on how to create such strings.
DB
type DB = SqlPersistT Habbix
runLocalDB :: DB a -> Habbix a
Execute a transaction in the local DB.
runRemoteDB :: SqlPersistT Habbix a -> Habbix a
Execute a transaction in the remote DB.
module Models
module ZabbixModels
Utility
asks :: MonadReader r m => (r -> a) -> m a