svcctx

package
v1.10.2 Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2025 License: GPL-3.0 Imports: 2 Imported by: 0

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

func Get() context.Context

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.

Jump to

Keyboard shortcuts

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