Safe Haskell | None |
---|---|
Language | Haskell2010 |
This module encapsulates knowledge about the SQL commands and the Hasql interface.
- notifyPool :: Pool -> ByteString -> ByteString -> IO (Either Error ())
- notify :: Connection -> ByteString -> ByteString -> IO (Either Error ())
- listen :: Connection -> ByteString -> IO ()
- unlisten :: Connection -> ByteString -> IO ()
- waitForNotifications :: (ByteString -> ByteString -> IO ()) -> Connection -> IO ()
Documentation
notifyPool :: Pool -> ByteString -> ByteString -> IO (Either Error ()) Source #
Given a Hasql Pool, a channel and a message sends a notify command to the database
notify :: Connection -> ByteString -> ByteString -> IO (Either Error ()) Source #
Given a Hasql Connection, a channel and a message sends a notify command to the database
listen :: Connection -> ByteString -> IO () Source #
Given a Hasql Connection and a channel sends a listen command to the database
unlisten :: Connection -> ByteString -> IO () Source #
Given a Hasql Connection and a channel sends a unlisten command to the database
waitForNotifications :: (ByteString -> ByteString -> IO ()) -> Connection -> IO () Source #
Given a function that handles notifications and a Hasql connection forks a thread that listens on the database connection and calls the handler everytime a message arrives.
The message handler passed as first argument needs two parameters channel and payload.