xcontext

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Dec 1, 2021 License: Apache-2.0 Imports: 4 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

定义公共上下文结构,明确定义上下文结构,方便代码阅读

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseCtx

type BaseCtx struct {
	XLog  logs.Logger
	Timer *timer.XTimer
}

考虑到后续对操作生命周期做控制,先实现空context.Context接口,方便扩展 同时定义扩展全局需要的公共成员,方便为各对象统一注入和管理

func (*BaseCtx) Deadline

func (t *BaseCtx) Deadline() (deadline time.Time, ok bool)

func (*BaseCtx) Done

func (t *BaseCtx) Done() <-chan struct{}

func (*BaseCtx) Err

func (t *BaseCtx) Err() error

func (*BaseCtx) GetLog

func (t *BaseCtx) GetLog() logs.Logger

func (*BaseCtx) GetTimer

func (t *BaseCtx) GetTimer() *timer.XTimer

func (*BaseCtx) Value

func (t *BaseCtx) Value(key interface{}) interface{}

type XContext

type XContext interface {
	context.Context
	GetLog() logs.Logger
	GetTimer() *timer.XTimer
}

Jump to

Keyboard shortcuts

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