Documentation
¶
Index ¶
- func Wait(ctx context.Context, handler *ListenHandler, opts ...WaitOption) error
- type ListenHandler
- func (h *ListenHandler) HandleNotification(ctx context.Context, notification *pgconn.Notification, _ *pgx.Conn) error
- func (h *ListenHandler) Has(id string) bool
- func (h *ListenHandler) Register(id string, callback func(context.Context) error) error
- func (h *ListenHandler) Unregister(id string) bool
- type WaitOption
- type WaitOptions
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Wait ¶
func Wait(ctx context.Context, handler *ListenHandler, opts ...WaitOption) error
Types ¶
type ListenHandler ¶
type ListenHandler struct {
// contains filtered or unexported fields
}
func (*ListenHandler) HandleNotification ¶
func (h *ListenHandler) HandleNotification(ctx context.Context, notification *pgconn.Notification, _ *pgx.Conn) error
HandleNotification implements the pgxlisten.Handler interface.
func (*ListenHandler) Has ¶
func (h *ListenHandler) Has(id string) bool
Has checks if a waiter with the given ID is registered.
func (*ListenHandler) Unregister ¶
func (h *ListenHandler) Unregister(id string) bool
Unregister unregisters an ID from receiving notifications.
type WaitOption ¶
type WaitOption func(*WaitOptions)
func WithAfterRegister ¶
func WithAfterRegister(callback func() error) WaitOption
WithAfterRegister allows setting a callback to be called after the waiter is registered.
func WithID ¶
func WithID(id string) WaitOption
WithID allows setting a unique identifier for the waiter.
type WaitOptions ¶
type WaitOptions struct {
// contains filtered or unexported fields
}
Click to show internal directories.
Click to hide internal directories.