context

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jul 23, 2019 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Background

func Background() *context

Background context wrapper

func FromContext

func FromContext(ctx stdcontext.Context) *context

FromContext returns a new context from a parent

func GetCorrelationID

func GetCorrelationID(ctx stdcontext.Context) string

GetCorrelationID returns the correlation if there is one

func New

func New(opts ...Option) *context

New constructs a new *context from a parent Context and Options

func WithTimeout

func WithTimeout(parent Context, timeout time.Duration) (Context, CancelFunc)

WithTimeout wraps stdcontext.WithTimeout

Types

type CancelFunc

type CancelFunc func()

A CancelFunc tells an operation to abandon its work

func WithCancel

func WithCancel(parent stdcontext.Context) (*context, CancelFunc)

WithCancel returns a copy of parent with a new Done channel

type Context

type Context stdcontext.Context

Context that matches std context

type Option

type Option func(*context)

Option allows configuring the context

func WithArgument

func WithArgument(key string, value interface{}) Option

WithArgument sets a Context argument

func WithArguments

func WithArguments(args map[string]interface{}) Option

WithArguments sets the Context arguments

func WithCorrelationID

func WithCorrelationID(cID string) Option

WithCorrelationID sets the CorrelationID

func WithMethod

func WithMethod(method string) Option

WithMethod sets the Context method name

func WithParent

func WithParent(parent Context) Option

WithParent sets the context's parent context

Jump to

Keyboard shortcuts

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