postgresql-simple-0.2.4.1: Mid-Level PostgreSQL client library

Stability | experimental
Maintainer | leon@melding-monads.com
Safe Haskell | None

Database.PostgreSQL.Simple.Notification

Description

Support for receiving asynchronous notifications via PostgreSQL's Listen/Notify mechanism. See http://www.postgresql.org/docs/9.1/static/sql-notify.html for more information.

Synopsis

- data Notification = Notification {
  - notificationPid :: !CPid
  - notificationChannel :: !ByteString
  - notificationData :: !ByteString
  }
- getNotification :: Connection -> IO Notification
- getNotificationNonBlocking :: Connection -> IO (Maybe Notification)

# Documentation

data Notification

Constructors

Notification |

Fields

notificationPid :: !CPid
notificationChannel :: !ByteString
notificationData :: !ByteString

getNotification :: Connection -> IO Notification

Returns a single notification. If no notifications are available, `getNotification` blocks until one arrives.

getNotificationNonBlocking :: Connection -> IO (Maybe Notification)

Non-blocking variant of `getNotification`. Returns a single notification, if available. If no notifications are available, returns `Nothing`.