Documentation
¶
Overview ¶
Package svcctx is a small package that provides a long-lived service/root context for the application. It can be initialized once at program startup and used as a safe fallback context in places that are not tied to an active HTTP request (e.g., background tasks, singleflight leaders, queues).
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Get ¶
Get returns the initialized root context if available, otherwise context.Background(). This ensures callers always receive a non-nil context.
func GetCtxWithCancel ¶
func GetCtxWithCancel() (context.Context, context.CancelFunc)
GetCtxWithCancel returns a root context and its associated cancel function, initializing them if not already set.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.