ctxutil

package
v0.0.0-...-a99bcb5 Latest Latest
Warning

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

Go to latest
Published: Dec 2, 2026 License: OSL-3.0 Imports: 2 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package ctxutil holds small context helpers shared across bounded contexts. Keep it minimal: add a helper here only when more than one package needs it.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DetachedWithDeadline

func DetachedWithDeadline(ctx context.Context, deadline time.Time) (context.Context, context.CancelFunc)

DetachedWithDeadline is DetachedWithTimeout with an absolute deadline: ctx's values are kept, its cancellation and deadline are dropped, and the result ends at deadline. Use it when several detached phases must share one schedule anchored on an earlier deadline instead of each starting a fresh timeout from "now". A deadline already in the past yields a context that is already done. Always defer the returned CancelFunc.

func DetachedWithTimeout

func DetachedWithTimeout(ctx context.Context, d time.Duration) (context.Context, context.CancelFunc)

DetachedWithTimeout returns a context that keeps ctx's values but drops its cancellation and deadline, bounded instead by a fresh timeout of d.

Use it for work that must outlive the request or caller that started it, such as a provider call that commits money and the terminal write recording its outcome: a client disconnect or a per-request timeout must not cancel either midway. Always defer the returned CancelFunc.

Types

This section is empty.

Jump to

Keyboard shortcuts

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