hasql-pool-0.4.1: A pool of connections for Hasql

Safe Haskell | None
Language | Haskell2010

Hasql.Pool

Synopsis

- data Pool
- type Settings = (Int, NominalDiffTime, Settings)
- acquire :: Settings -> IO Pool
- release :: Pool -> IO ()
- data UsageError
  - = ConnectionError !ConnectionError
  - | SessionError !Error
- use :: Pool -> Session a -> IO (Either UsageError a)

# Documentation

data Pool #

A pool of connections to DB.

type Settings = (Int, NominalDiffTime, Settings) #

Settings of the connection pool. Consist of:

- Pool-size.
- Timeout. An amount of time for which an unused resource is kept open. The smallest acceptable value is 0.5 seconds.
- Connection settings.

acquire :: Settings -> IO Pool #

Given the pool-size, timeout and connection settings create a connection-pool.

release :: Pool -> IO () #

Release the connection-pool.

data UsageError #

A union over the connection establishment error and the session error.

Constructors

ConnectionError !ConnectionError |
SessionError !Error |

Instances

Eq UsageError # |
Methods (==) :: UsageError -> UsageError -> Bool # (/=) :: UsageError -> UsageError -> Bool #
Show UsageError # |
Methods showsPrec :: Int -> UsageError -> ShowS # show :: UsageError -> String # showList :: [UsageError] -> ShowS #

use :: Pool -> Session a -> IO (Either UsageError a) #

Use a connection from the pool to run a session and return the connection to the pool, when finished.