Safe Haskell | None |
---|---|
Language | Haskell2010 |
PostgreSQL backend for Selda.
- data PGConnectInfo = PGConnectInfo {
- pgHost :: Text
- pgPort :: Int
- pgDatabase :: Text
- pgUsername :: Maybe Text
- pgPassword :: Maybe Text
- withPostgreSQL :: (MonadIO m, MonadThrow m, MonadMask m) => PGConnectInfo -> SeldaT m a -> m a
- on :: Text -> Text -> PGConnectInfo
- auth :: PGConnectInfo -> (Text, Text) -> PGConnectInfo
- pgBackend :: Text -> Connection -> SeldaBackend
- pgConnString :: PGConnectInfo -> ByteString
Documentation
data PGConnectInfo Source #
PostgreSQL connection information.
PGConnectInfo | |
|
withPostgreSQL :: (MonadIO m, MonadThrow m, MonadMask m) => PGConnectInfo -> SeldaT m a -> m a Source #
Perform the given computation over a PostgreSQL database. The database connection is guaranteed to be closed when the computation terminates.
on :: Text -> Text -> PGConnectInfo infixl 7 Source #
Connect to the given database on the given host, on the default PostgreSQL port (5432):
withPostgreSQL ("my_db" `on` "example.com") $ do ...
auth :: PGConnectInfo -> (Text, Text) -> PGConnectInfo infixl 4 Source #
Add the given username and password to the given connection information:
withPostgreSQL ("my_db" `on` "example.com" `auth` ("user", "pass")) $ do ...
For more precise control over the connection options, you should modify
the PGConnectInfo
directly.
:: Text | Unique database identifier. Preferably the connection string used to open the connection. |
-> Connection | PostgreSQL connection object. |
-> SeldaBackend |
Create a SeldaBackend
for PostgreSQL Connection
pgConnString :: PGConnectInfo -> ByteString Source #
Convert PGConnectInfo
into ByteString