Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- 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]
- defaultConnectionSettings :: ConnectionSettings
- newtype ConnectionSourceM m = ConnectionSourceM {
- withConnection :: forall r. (Connection -> m r) -> m r
- newtype ConnectionSource (cs :: [(* -> *) -> Constraint]) = 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 | |
|
Instances
Eq ConnectionStats Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Connection (==) :: ConnectionStats -> ConnectionStats -> Bool # (/=) :: ConnectionStats -> ConnectionStats -> Bool # | |
Ord ConnectionStats Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Connection compare :: ConnectionStats -> ConnectionStats -> Ordering # (<) :: ConnectionStats -> ConnectionStats -> Bool # (<=) :: ConnectionStats -> ConnectionStats -> Bool # (>) :: ConnectionStats -> ConnectionStats -> Bool # (>=) :: ConnectionStats -> ConnectionStats -> Bool # max :: ConnectionStats -> ConnectionStats -> ConnectionStats # min :: ConnectionStats -> ConnectionStats -> ConnectionStats # | |
Show ConnectionStats Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Connection showsPrec :: Int -> ConnectionStats -> ShowS # show :: ConnectionStats -> String # showList :: [ConnectionStats] -> ShowS # |
data ConnectionSettings Source #
ConnectionSettings | |
|
Instances
Eq ConnectionSettings Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Connection (==) :: ConnectionSettings -> ConnectionSettings -> Bool # (/=) :: ConnectionSettings -> ConnectionSettings -> Bool # | |
Ord ConnectionSettings Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Connection compare :: ConnectionSettings -> ConnectionSettings -> Ordering # (<) :: ConnectionSettings -> ConnectionSettings -> Bool # (<=) :: ConnectionSettings -> ConnectionSettings -> Bool # (>) :: ConnectionSettings -> ConnectionSettings -> Bool # (>=) :: ConnectionSettings -> ConnectionSettings -> Bool # max :: ConnectionSettings -> ConnectionSettings -> ConnectionSettings # min :: ConnectionSettings -> ConnectionSettings -> ConnectionSettings # | |
Show ConnectionSettings Source # | |
Defined in Database.PostgreSQL.PQTypes.Internal.Connection showsPrec :: Int -> ConnectionSettings -> ShowS # show :: ConnectionSettings -> String # showList :: [ConnectionSettings] -> ShowS # |
defaultConnectionSettings :: 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 :: [(* -> *) -> Constraint]) Source #
Wrapper for a polymorphic connection source.
ConnectionSource | |
|
simpleSource :: ConnectionSettings -> ConnectionSource [MonadBase IO, MonadMask] Source #
Default connection supplier. It establishes 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 established 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.