postgres-nio
postgres-nio copied to clipboard
Support async Listen/Notify API
The current Listen/Notify is not usable in a structured concurrency context. We should provide something better:
Goals
-
Provide a new method on connection:
public func listen(_ channel: String) async throws -> PostgresNotificationSequence -
The new
PostgresNotificationSequencecan be backed by anAsyncThrowingStream<String>internally. However we should not expose this, as this gives us greater flexibility down the road. -
We should create a
ListenStateMachinein the PostgresConnection that we update for each Listen channel.
Work has started in #264.