lib / pq

Pure Go Postgres driver for database/sql
https://pkg.go.dev/github.com/lib/pq
MIT License
8.98k stars 909 forks source link

Add handler for LISTEN/NOTIFY notifications #965

Closed jordanlewis closed 4 years ago

jordanlewis commented 4 years ago

lib/pq currently has a dedicated set of functionality for subscribing to LISTEN/NOTIFY messages, but you have to use it on a separate connection.

This commit adds a simple way to register a handler for notifications that is on an ordinary database connection. This is useful if a user wants to LISTEN to a channel on the same connection as their ordinary database connection.

jordanlewis commented 4 years ago

@mjibson PTAL. This is for adding messages to cockroach sql when a connection receives a LISTEN/NOTIFY message. See https://github.com/cockroachdb/cockroach/pull/48308.

jordanlewis commented 4 years ago

Thanks!