contexthelper

package
v0.26.3 Latest Latest
Warning

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

Go to latest
Published: Apr 10, 2022 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DropCancelContext added in v0.23.10

func DropCancelContext(ctx context.Context) context.Context

Types

type CombinedContext

type CombinedContext struct {
	// contains filtered or unexported fields
}

func CombineContext

func CombineContext(contexts ...context.Context) *CombinedContext

CombineContext return combined context: common deadline, values, close. Minimum one of underly contexts MUST be closed for prevent memory leak.

func (*CombinedContext) Deadline

func (cc *CombinedContext) Deadline() (deadline time.Time, ok bool)

Deadline return minimum of contextx deadlines, if present

func (*CombinedContext) Done

func (cc *CombinedContext) Done() <-chan struct{}

Done return channel, that will close when first of initial contexts will closed

func (*CombinedContext) Err

func (cc *CombinedContext) Err() error

Err return error, of context, which close handled first

func (*CombinedContext) Value

func (cc *CombinedContext) Value(key interface{}) interface{}

Value return value of key. It iterate over initial context one by one and return first not nil value. If all of contextx return nil - return nil too

Jump to

Keyboard shortcuts

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