-- Hoogle documentation, generated by Haddock
-- See Hoogle, http://www.haskell.org/hoogle/
-- | Pool of connections for Hasql
--
-- Pool of connections for Hasql
@package hasql-pool
@version 0.9
module Hasql.Pool
-- | Pool of connections to DB.
data Pool
-- | Create a connection-pool, with default settings.
--
-- No connections actually get established by this function. It is
-- delegated to use.
acquire :: Int -> DiffTime -> DiffTime -> Settings -> IO Pool
-- | Create a connection-pool.
--
-- In difference to acquire new connection settings get fetched
-- each time a connection is created. This may be useful for some
-- security models.
--
-- No connections actually get established by this function. It is
-- delegated to use.
acquireDynamically :: Int -> DiffTime -> DiffTime -> IO Settings -> IO Pool
-- | Use a connection from the pool to run a session and return the
-- connection to the pool, when finished.
--
-- Session failing with a ClientError gets interpreted as a loss
-- of connection. In such case the connection does not get returned to
-- the pool and a slot gets freed up for a new connection to be
-- established the next time one is needed. The error still gets returned
-- from this function.
use :: Pool -> Session a -> IO (Either UsageError a)
-- | Release all the idle connections in the pool, and mark the in-use
-- connections to be released after use. Any connections acquired after
-- the call will be freshly established.
--
-- The pool remains usable after this action. So you can use this
-- function to reset the connections in the pool. Naturally, you can also
-- use it to release the resources.
release :: Pool -> IO ()
-- | Union over all errors that use can result in.
data UsageError
-- | Attempt to establish a connection failed.
ConnectionUsageError :: ConnectionError -> UsageError
-- | Session execution failed.
SessionUsageError :: QueryError -> UsageError
-- | Timeout acquiring a connection.
AcquisitionTimeoutUsageError :: UsageError
instance GHC.Classes.Eq Hasql.Pool.UsageError
instance GHC.Show.Show Hasql.Pool.UsageError
instance GHC.Exception.Type.Exception Hasql.Pool.UsageError