package ctxwatch
Import Path
github.com/jackc/pgx/v5/pgconn/ctxwatch (on go.dev)
Dependency Relation
imports 2 packages, and imported by one package
Involved Source Files
context_watcher.go
Package-Level Type Names (total 2, both are exported)
ContextWatcher watches a context and performs an action when the context is canceled. It can watch one context at a
time.
done chan struct{}
handler Handler
Lock protects the members below.
Stop is the handle for an "after func". See [context.AfterFunc].
Unwatch stops watching the previously watched context. If the onCancel function passed to NewContextWatcher was
called then onUnwatchAfterCancel will also be called.
Watch starts watching ctx. If ctx is canceled then the onCancel function passed to NewContextWatcher will be called.
func NewContextWatcher(handler Handler) *ContextWatcher
HandleCancel is called when the context that a ContextWatcher is currently watching is canceled. canceledCtx is the
context that was canceled.
HandleUnwatchAfterCancel is called when a ContextWatcher that called HandleCancel on this Handler is unwatched.
*github.com/jackc/pgx/v5/pgconn.CancelRequestContextWatcherHandler
*github.com/jackc/pgx/v5/pgconn.DeadlineContextWatcherHandler
func NewContextWatcher(handler Handler) *ContextWatcher
Package-Level Functions (only one, which is exported)
NewContextWatcher returns a ContextWatcher. onCancel will be called when a watched context is canceled.
OnUnwatchAfterCancel will be called when Unwatch is called and the watched context had already been canceled and
onCancel called.
The pages are generated with Golds v0.7.6. (GOOS=linux GOARCH=amd64)