Help us shape the future of Go! Take the 2026 Go Developer Survey

handlerbase

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: May 30, 2025 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BaseMetaData

type BaseMetaData struct {
	IsCommand   bool
	MainCommand string
	TraceID     string
}

type Operator

type Operator[T, K any] interface {
	PreRun(context.Context, *T, *K) error
	Run(context.Context, *T, *K) error
	PostRun(context.Context, *T, *K) error
}

type OperatorBase

type OperatorBase[T, K any] struct{}

func (*OperatorBase[T, K]) PostRun

func (op *OperatorBase[T, K]) PostRun(context.Context, *T, *K) error

func (*OperatorBase[T, K]) PreRun

func (op *OperatorBase[T, K]) PreRun(context.Context, *T, *K) error

func (*OperatorBase[T, K]) Run

func (op *OperatorBase[T, K]) Run(context.Context, *T, *K) error

type ProcDeferFunc

type ProcDeferFunc[T, K any] func(context.Context, *T, *K)

type ProcPanicFunc

type ProcPanicFunc[T, K any] func(context.Context, K, *T)

type Processor

type Processor[T, K any] struct {
	context.Context
	// contains filtered or unexported fields
}

func (*Processor[T, K]) AddParallelStages

func (p *Processor[T, K]) AddParallelStages(stage Operator[T, K]) *Processor[T, K]

AddParallelStages 添加并行处理阶段

@receiver p
@param stage
@return *Processor[T]

func (*Processor[T, K]) AddStages

func (p *Processor[T, K]) AddStages(stage Operator[T, K]) *Processor[T, K]

AddStages 添加处理阶段

@receiver p
@param stage
@return *Processor[T]

func (*Processor[T, K]) Clean

func (p *Processor[T, K]) Clean() *Processor[T, K]

func (*Processor[T, K]) Defer

func (p *Processor[T, K]) Defer()

func (*Processor[T, K]) OnPanic

func (p *Processor[T, K]) OnPanic(fn ProcPanicFunc[T, error]) *Processor[T, K]

func (*Processor[T, K]) Run

func (p *Processor[T, K]) Run()

Run 运行

@receiver p
@param ctx
@param event

func (*Processor[T, K]) RunParallelStages

func (p *Processor[T, K]) RunParallelStages() error

RunParallelStages 运行并行处理阶段

@receiver p
@param ctx
@param event
@return error

func (*Processor[T, K]) RunStages

func (p *Processor[T, K]) RunStages() (err error)

RunStages 运行处理阶段

@receiver p
@param ctx
@param event

func (*Processor[T, K]) WithCtx

func (p *Processor[T, K]) WithCtx(ctx context.Context) *Processor[T, K]

func (*Processor[T, K]) WithDefer

func (p *Processor[T, K]) WithDefer(fns ...ProcDeferFunc[T, K]) *Processor[T, K]

func (*Processor[T, K]) WithEvent

func (p *Processor[T, K]) WithEvent(event *T) *Processor[T, K]

Jump to

Keyboard shortcuts

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