Safe Haskell | None |
---|---|
Language | Haskell98 |
- newtype Connection = Connection {}
- data ConnectionData = ConnectionData {
- cdFrgnPtr :: !(ForeignPtr (Ptr PGconn))
- cdPtr :: !(Ptr PGconn)
- cdStats :: !ConnectionStats
- withConnectionData :: Connection -> String -> (ConnectionData -> IO (ConnectionData, r)) -> IO r
- data ConnectionStats = ConnectionStats {
- statsQueries :: !Int
- statsRows :: !Int
- statsValues :: !Int
- statsParams :: !Int
- data ConnectionSettings = ConnectionSettings {
- csConnInfo :: !ByteString
- csClientEncoding :: !(Maybe ByteString)
- csComposites :: ![ByteString]
- defaultSettings :: ConnectionSettings
- newtype ConnectionSource = ConnectionSource {
- withConnection :: (MonadBase IO m, MonadMask m) => (Connection -> m a) -> m a
- defaultSource :: ConnectionSettings -> ConnectionSource
- poolSource :: ConnectionSettings -> Int -> NominalDiffTime -> Int -> IO ConnectionSource
- connect :: ConnectionSettings -> IO Connection
- disconnect :: Connection -> IO ()
Documentation
newtype Connection Source
Wrapper for hiding representation of a connection object.
data ConnectionData Source
Representation of a connection object.
ConnectionData | |
|
withConnectionData :: Connection -> String -> (ConnectionData -> IO (ConnectionData, r)) -> IO r Source
data ConnectionStats Source
Simple connection statistics.
ConnectionStats | |
|
data ConnectionSettings Source
ConnectionSettings | |
|
defaultSettings :: ConnectionSettings Source
Default connection settings.
newtype ConnectionSource Source
Database connection supplier.
ConnectionSource | |
|
defaultSource :: ConnectionSettings -> ConnectionSource Source
Default connection supplier. It estabilishes new
database connection each time withConnection
is called.
:: ConnectionSettings | |
-> Int | Stripe count. The number of distinct sub-pools to maintain. The smallest acceptable value is 1. |
-> NominalDiffTime | Amount of time for which an unused database connection is kept open. The smallest acceptable value is 0.5 seconds. The elapsed time before closing database connection may be a little longer than requested, as the reaper thread wakes at 1-second intervals. |
-> Int | Maximum number of database connections to keep open per stripe. The smallest acceptable value is 1. Requests for database connections will block if this limit is reached on a single stripe, even if other stripes have idle connections available. |
-> IO ConnectionSource |
Pooled source. It uses striped pool from resource-pool package to cache estabilished connections and reuse them.
connect :: ConnectionSettings -> IO Connection Source
Low-level function for connecting to the database. Useful if one wants to implement custom connection source.
disconnect :: Connection -> IO () Source
Low-level function for disconnecting from the database. Useful if one wants to implement custom connection source.