-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/


-- | Backend for the persistent library using postgresql.
--   
--   Based on the postgresql-simple package
@package persistent-postgresql
@version 1.3.1.1


-- | A postgresql backend for persistent.
module Database.Persist.Postgresql

-- | 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 <a>ConnectionPool</a> outside the action
--   since it may be already been released.
withPostgresqlPool :: MonadIO m => ConnectionString -> Int -> (ConnectionPool -> m a) -> m a

-- | Same as <a>withPostgresqlPool</a>, but instead of opening a pool of
--   connections, only one connection is opened.
withPostgresqlConn :: (MonadIO m, MonadBaseControl IO m) => ConnectionString -> (Connection -> m a) -> m a

-- | Create a PostgreSQL connection pool. Note that it's your
--   responsability to properly close the connection pool when unneeded.
--   Use <a>withPostgresqlPool</a> for an automatic resource control.
createPostgresqlPool :: MonadIO m => ConnectionString -> Int -> m ConnectionPool

-- | A <tt>libpq</tt> connection string. A simple example of connection
--   string would be <tt>"host=localhost port=5432 user=test dbname=test
--   password=test"</tt>. Please read libpq's documentation at
--   <a>http://www.postgresql.org/docs/9.1/static/libpq-connect.html</a>
--   for more details on how to create such strings.
type ConnectionString = ByteString

-- | Information required to connect to a PostgreSQL database using
--   <tt>persistent</tt>'s generic facilities. These values are the same
--   that are given to <a>withPostgresqlPool</a>.
data PostgresConf
PostgresConf :: ConnectionString -> Int -> PostgresConf

-- | The connection string.
pgConnStr :: PostgresConf -> ConnectionString

-- | How many connections should be held on the connection pool.
pgPoolSize :: PostgresConf -> Int

-- | Generate a <a>Connection</a> from a <a>Connection</a>
openSimpleConn :: Connection -> IO Connection
instance Typeable Unknown
instance Eq Unknown
instance Show Unknown
instance Read Unknown
instance Ord Unknown
instance PersistConfig PostgresConf
instance ToField Unknown
instance FromField Unknown
instance ToField P
