gctx

package
v0.1.34 Latest Latest
Warning

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

Go to latest
Published: Jun 26, 2024 License: LGPL-2.1 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func UnsafeContext deprecated

func UnsafeContext(ctx Context) _UnsafeContext

Deprecated: UnsafeContext 访问上下文内部方法

Types

type ConcurrentContextProvider

type ConcurrentContextProvider interface {
	// GetConcurrentContext 获取多线程安全的上下文
	GetConcurrentContext() iface.Cache
}

ConcurrentContextProvider 多线程安全的上下文提供者

type Context

type Context interface {
	context.Context

	// GetParentContext 获取父上下文
	GetParentContext() context.Context
	// GetAutoRecover panic时是否自动恢复
	GetAutoRecover() bool
	// GetReportError 在开启panic时自动恢复时,将会恢复并将错误写入此error channel
	GetReportError() chan error
	// GetWaitGroup 获取等待组
	GetWaitGroup() *sync.WaitGroup
	// Terminate 停止
	Terminate() <-chan struct{}
	// TerminatedChan 已停止chan
	TerminatedChan() <-chan struct{}
	// contains filtered or unexported methods
}

Context 上下文

type ContextBehavior

type ContextBehavior struct {
	context.Context
	// contains filtered or unexported fields
}

ContextBehavior 上下文行为

func (*ContextBehavior) GetAutoRecover

func (ctx *ContextBehavior) GetAutoRecover() bool

GetAutoRecover panic时是否自动恢复

func (*ContextBehavior) GetParentContext

func (ctx *ContextBehavior) GetParentContext() context.Context

GetParentContext 获取父上下文

func (*ContextBehavior) GetReportError

func (ctx *ContextBehavior) GetReportError() chan error

GetReportError 在开启panic时自动恢复时,将会恢复并将错误写入此error channel

func (*ContextBehavior) GetWaitGroup

func (ctx *ContextBehavior) GetWaitGroup() *sync.WaitGroup

GetWaitGroup 获取等待组

func (*ContextBehavior) Terminate

func (ctx *ContextBehavior) Terminate() <-chan struct{}

Terminate 停止

func (*ContextBehavior) TerminatedChan

func (ctx *ContextBehavior) TerminatedChan() <-chan struct{}

TerminatedChan 已停止chan

type CurrentContextProvider

type CurrentContextProvider interface {
	ConcurrentContextProvider
	// GetCurrentContext 获取当前上下文
	GetCurrentContext() iface.Cache
}

CurrentContextProvider 当前上下文提供者

Jump to

Keyboard shortcuts

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