waitqueue

package
v0.4.5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 5, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

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) Register

func (h *ListenHandler) Register(id string, callback func(context.Context) error) error

Register registers a callback to receive notifications.

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL