Safe Haskell | None |
---|---|
Language | Haskell2010 |
Pool
acquire :: Int -> Settings -> IO Pool Source #
Given the pool-size and connection settings create a connection-pool.
No connections actually get established by this function. It is delegated
to use
.
use :: Pool -> Session a -> IO (Either UsageError a) Source #
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.
Errors
data UsageError Source #
Union over all errors that use
can result in.
ConnectionUsageError ConnectionError | Attempt to establish a connection failed. |
SessionUsageError QueryError | Session execution failed. |
PoolIsReleasedUsageError | Attempt to use a pool, which has already been called |
Instances
Eq UsageError Source # | |
Defined in Hasql.Pool (==) :: UsageError -> UsageError -> Bool # (/=) :: UsageError -> UsageError -> Bool # | |
Show UsageError Source # | |
Defined in Hasql.Pool showsPrec :: Int -> UsageError -> ShowS # show :: UsageError -> String # showList :: [UsageError] -> ShowS # | |
Exception UsageError Source # | |
Defined in Hasql.Pool toException :: UsageError -> SomeException # fromException :: SomeException -> Maybe UsageError # displayException :: UsageError -> String # |