Safe Haskell | None |
---|---|
Language | Haskell2010 |
- 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 :: !Text
- csClientEncoding :: !(Maybe Text)
- csComposites :: ![Text]
- def :: Default a => a
- newtype ConnectionSourceM m = ConnectionSourceM {
- withConnection :: forall r. (Connection -> m r) -> m r
- newtype ConnectionSource cs = ConnectionSource {
- unConnectionSource :: forall m. MkConstraint m cs => ConnectionSourceM m
- simpleSource :: ConnectionSettings -> ConnectionSource '[MonadBase IO, MonadMask]
- poolSource :: ConnectionSettings -> Int -> NominalDiffTime -> Int -> IO (ConnectionSource '[MonadBase IO, MonadMask])
- 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 | |
|
Eq ConnectionSettings Source # | |
Ord ConnectionSettings Source # | |
Show ConnectionSettings Source # | |
Default ConnectionSettings Source # | Default connection settings. Note that all strings sent to PostgreSQL by the library are encoded as UTF-8, so don't alter client encoding unless you know what you're doing. |
newtype ConnectionSourceM m Source #
Database connection supplier.
ConnectionSourceM | |
|
newtype ConnectionSource cs Source #
Wrapper for a polymorphic connection source.
ConnectionSource | |
|
simpleSource :: ConnectionSettings -> ConnectionSource '[MonadBase IO, MonadMask] 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 '[MonadBase IO, MonadMask]) |
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.