Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module provides utilities for using PostgreSQL with
Control.Monad.Persist and persistent
.
- data PostgresOptions = PostgresOptions {}
- postgresOptions :: (AsEmpty e, AsUnread e, AsUnset e) => Parser e PostgresOptions
- withPostgresqlPool :: (MonadBaseControl IO m, MonadLogger m) => PostgresOptions -> Int -> (Pool SqlBackend -> m a) -> m a
- withPostgresqlConn :: (MonadBaseControl IO m, MonadLogger m) => PostgresOptions -> (SqlBackend -> m a) -> m a
Documentation
data PostgresOptions Source #
Connection options needed to connect to PostgreSQL. You can use
postgresOptions
to parse these options from the environment.
postgresOptions :: (AsEmpty e, AsUnread e, AsUnset e) => Parser e PostgresOptions Source #
An envparse
Parser
that parses PostgresOptions
from the environment,
looking for the environment variables PG_HOST
, PG_PORT
, PG_USER
,
PG_USER
, PG_DB_NAME
, and PG_PASSWORD
. All of them are optional except
for PG_DB_NAME
.
:: (MonadBaseControl IO m, MonadLogger m) | |
=> PostgresOptions | Options to connect to the database. |
-> Int | Number of connections to be kept open in the pool. |
-> (Pool SqlBackend -> m a) | Action to be executed that uses the connection pool. |
-> m a |
Like withPostgresqlPool
from Database.Persist.Postgresql, except using
PostgresOptions
.
withPostgresqlConn :: (MonadBaseControl IO m, MonadLogger m) => PostgresOptions -> (SqlBackend -> m a) -> m a Source #
Like withPostgresqlConn
from Database.Persist.Postgresql, except using
PostgresOptions
.