Documentation ¶
Index ¶
- func GetApplicationContext(cc context.Context) (application.Context, error)
- func SetupApplicationContext(ac application.Context) error
- func SetupContextSetter(setter ContextSetter) error
- type ContextSetter
- type SimpleContext
- func (inst *SimpleContext) Deadline() (deadline time.Time, ok bool)
- func (inst *SimpleContext) Done() <-chan struct{}
- func (inst *SimpleContext) Err() error
- func (inst *SimpleContext) GetContext() context.Context
- func (inst *SimpleContext) SetValue(key interface{}, value interface{})
- func (inst *SimpleContext) Value(key interface{}) interface{}
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) 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 取属性值
Click to show internal directories.
Click to hide internal directories.