interceptor

package
v0.0.0-...-3d44fc7 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Context

type Context struct {
	Ctx        CtxInterface
	Attributes map[string]interface{}
}

func (*Context) Get

func (c *Context) Get(key string) interface{}

func (*Context) GetParams

func (c *Context) GetParams() map[string][]string

func (*Context) GetPath

func (c *Context) GetPath() string

func (*Context) GetPathParam

func (c *Context) GetPathParam() map[string]string

func (*Context) IsFinish

func (c *Context) IsFinish() bool

func (*Context) Put

func (c *Context) Put(key string, value interface{})

func (*Context) SetResponse

func (c *Context) SetResponse(data interface{})

type CtxInterface

type CtxInterface interface {
	SetResponse(data interface{})
	IsFinish() bool
	GetPath() string
	GetPathParam() map[string]string
	GetParams() map[string][]string
}

type Interceptor

type Interceptor interface {
	Before(ctx *Context) e.ApiError                // 执行业务前执行
	After(ctx *Context, err e.ApiError) e.ApiError // 执行业务后执行,参数err为业务返回的ApiErr信息
	OnPanic(ctx *Context) e.ApiError               // 发生panic时执行
}

type Item

type Item struct {
	Interceptor Interceptor
	Order       int
}

type ItemSort

type ItemSort []Item

func (ItemSort) DoInterceptor

func (itemList ItemSort) DoInterceptor(ctx *Context, doTargetMethod func() e.ApiError) e.ApiError

func (ItemSort) Len

func (itemList ItemSort) Len() int

func (ItemSort) Less

func (itemList ItemSort) Less(i, j int) bool

func (ItemSort) Swap

func (itemList ItemSort) Swap(i, j int)

Jump to

Keyboard shortcuts

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