context

package
v1.0.7 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2021 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Ctx    context.Context
	Logger log.Logger
}

Context is used to in dm to record some context field like * go context * logger

func Background

func Background() *Context

Background return a nop context

func NewContext

func NewContext(ctx context.Context, logger log.Logger) *Context

NewContext return a new Context

func (*Context) Context

func (c *Context) Context() context.Context

Context returns real context

func (*Context) L

func (c *Context) L() log.Logger

L returns real logger

func (*Context) WithContext

func (c *Context) WithContext(ctx context.Context) *Context

WithContext set go context

func (*Context) WithLogger

func (c *Context) WithLogger(logger log.Logger) *Context

WithLogger set logger

func (*Context) WithTimeout added in v1.0.3

func (c *Context) WithTimeout(timeout time.Duration) (*Context, context.CancelFunc)

WithTimeout sets a timeout associated context.

Jump to

Keyboard shortcuts

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