persistent-postgresql-1.3.1.2: Backend for the persistent library using postgresql.

Safe HaskellNone

Database.Persist.Postgresql

Description

A postgresql backend for persistent.

Synopsis

Documentation

withPostgresqlPoolSource

Arguments

:: MonadIO m 
=> ConnectionString

Connection string to the database.

-> Int

Number of connections to be kept open in the pool.

-> (ConnectionPool -> m a)

Action to be executed that uses the connection pool.

-> m a 

Create a PostgreSQL connection pool and run the given action. The pool is properly released after the action finishes using it. Note that you should not use the given ConnectionPool outside the action since it may be already been released.

withPostgresqlConn :: (MonadIO m, MonadBaseControl IO m) => ConnectionString -> (Connection -> m a) -> m aSource

Same as withPostgresqlPool, but instead of opening a pool of connections, only one connection is opened.

createPostgresqlPoolSource

Arguments

:: MonadIO m 
=> ConnectionString

Connection string to the database.

-> Int

Number of connections to be kept open in the pool.

-> m ConnectionPool 

Create a PostgreSQL connection pool. Note that it's your responsability to properly close the connection pool when unneeded. Use withPostgresqlPool for an automatic resource control.

type ConnectionString = ByteStringSource

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.

data PostgresConf Source

Information required to connect to a PostgreSQL database using persistent's generic facilities. These values are the same that are given to withPostgresqlPool.

Constructors

PostgresConf 

Fields

pgConnStr :: ConnectionString

The connection string.

pgPoolSize :: Int

How many connections should be held on the connection pool.