contexts

package
v0.1.9 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2023 License: MIT Imports: 5 Imported by: 8

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetApplicationContext

func GetApplicationContext(cc context.Context) (application.Context, error)

GetApplicationContext 取 application.Context

func SetupApplicationContext

func SetupApplicationContext(ac application.Context) error

SetupApplicationContext 设置 application.Context

func SetupContextSetter

func SetupContextSetter(setter ContextSetter) error

SetupContextSetter 绑定当前上下文

Types

type ContextSetter

type ContextSetter interface {
	GetContext() context.Context
	SetValue(key interface{}, value interface{})
}

ContextSetter 是 context.Context 独享的设置入口

func GetContextSetter

func GetContextSetter(cc context.Context) (ContextSetter, error)

GetContextSetter 获取已绑定的可编辑上下文

type SimpleContext

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

SimpleContext 一个简单的 lang.Context 实现

func (*SimpleContext) Deadline

func (inst *SimpleContext) Deadline() (deadline time.Time, ok bool)

Deadline 取上下文的截止日期

func (*SimpleContext) Done

func (inst *SimpleContext) Done() <-chan struct{}

Done ... of context.Context

func (*SimpleContext) Err

func (inst *SimpleContext) Err() error

Err ... of context.Context

func (*SimpleContext) GetContext

func (inst *SimpleContext) GetContext() context.Context

GetContext 取setter的context

func (*SimpleContext) SetValue

func (inst *SimpleContext) SetValue(key interface{}, value interface{})

SetValue 设置属性值

func (*SimpleContext) Value

func (inst *SimpleContext) Value(key interface{}) interface{}

Value 取属性值

Jump to

Keyboard shortcuts

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