chain

package
v0.3.11 Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2024 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrTooManyHandle = errors.New("too many handlers, at most 63 handlers is allowed")
	ErrNoHandle      = errors.New("chain has no handlers, forget call Use()?")
)

Functions

This section is empty.

Types

type Chain

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

func (*Chain) Handle

func (chain *Chain) Handle(opts ...Option) error

func (*Chain) Load added in v0.3.10

func (chain *Chain) Load() (any, bool)

get instance global meta

func (*Chain) Store added in v0.3.10

func (chain *Chain) Store(v any)

set instance global meta

func (*Chain) Use

func (chain *Chain) Use(handlers ...Handler) error

type Context

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

func (*Context) Abort

func (c *Context) Abort()

func (*Context) AbortWithError

func (c *Context) AbortWithError(err error)

func (*Context) Error

func (c *Context) Error() error

func (*Context) Get

func (c *Context) Get() (any, bool)

func (*Context) IsAborted

func (c *Context) IsAborted() bool

func (*Context) Load added in v0.3.8

func (c *Context) Load() (any, bool)

get instance global meta

func (*Context) Next

func (c *Context) Next()

func (*Context) Request added in v0.3.8

func (c *Context) Request() (any, bool)

func (*Context) Set

func (c *Context) Set(v any)

func (*Context) Store added in v0.3.8

func (c *Context) Store(v any)

set instance global meta

type Handler

type Handler interface {
	Name() string
	Execute(*Context)
}

type Option added in v0.3.8

type Option func(*Context)

func WithContext added in v0.3.10

func WithContext(ctx context.Context) Option

func WithRequest added in v0.3.8

func WithRequest(req any) Option

unmarshal and set request

Jump to

Keyboard shortcuts

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