mutcontext

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Mutable context, allows for easy setting additional values shared across all context and it's children

Index

Constants

This section is empty.

Variables

View Source
var ErrNoCancel = errors.New("no cancel func")

returned if no cancel func present

Functions

This section is empty.

Types

type FuncCleanup

type FuncCleanup func()

cleanup closure

type MutableContext

type MutableContext interface {
	context.Context
	Set(key, value interface{})
	Cancel() error
	SetCleanup(cleanup FuncCleanup)
	Complete()
	Completed() bool
}

Mutable context interface, allows easy setting values and keeping cancel() function

func CreateNew

func CreateNew(ctx context.Context) MutableContext

Constructor without cancel() function, will make ctx.Cancel() != nil

func CreateNewCancel

func CreateNewCancel(ctx context.Context, cancel context.CancelFunc) MutableContext

Constructor with cancel() function

Jump to

Keyboard shortcuts

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