No matching definitions.

postgres/notify

src/postgres/notify.tur
defopaque

Notification

(Notification)

opaque handle to a libpq PGnotify notification.

defn

notify-listen

(notify-listen [^borrow conn : Conn channel : cstr] :)
defn

notify-unlisten

(notify-unlisten [^borrow conn : Conn channel : cstr] :)

unsubscribe from asynchronous notifications on a channel.

connconnection handle
channelchannel name to stop listening on

(Result int int) -- ok carries 0; err carries 0 on failure.

(notify-unlisten conn "my_channel")

Since: PG3

defn

notify-poll

(notify-poll [^borrow conn : Conn] :)
defn

notification-channel

(notification-channel [n : Notification] :)

return the channel name of a PGnotify notification.

nnotification handle (ok-val from notify-poll when non-zero)

Channel name as :cstr (valid until PQfreemem is called on n).

(notification-channel notif)  ; => "my_channel"

Since: PG3

defn

notification-payload

(notification-payload [n : Notification] :)

return the payload string of a PGnotify notification.

nnotification handle (ok-val from notify-poll when non-zero)

Payload as :cstr (valid until PQfreemem is called on n); "" if none.

(notification-payload notif)  ; => "hello"

Since: PG3

Internal definitions
__listen-sql-- build "LISTEN channel" as a heap-allocated cstr.
__unlisten-sql-- build "UNLISTEN channel" as a heap-allocated cstr.
__pq-exec-raw-- execute SQL with no params; returns 1 on success, 0 on failure.
__pq-consume-input-- call PQconsumeInput; returns 1 on success, 0 on error.
__pq-notifies-- call PQnotifies; returns PGnotify* as :int (0 if none pending).
__notify-result-of-rc-- subscribe to asynchronous notifications on a channel.
__notify-poll-ok-- poll for a pending notification without blocking.
__notify-poll-err