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

middleware

package
v0.13.5 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2020 License: MIT Imports: 30 Imported by: 0

Documentation

Index

Constants

View Source
const DELAY_HEADER_KEY = "X-Add-Delay"

DELAY_HEADER_KEY 延时请求头名称

Variables

This section is empty.

Functions

func Body

func Body() dispatcher.HandlerFunc

Body 处理请求的body参数

func ContextHandler

func ContextHandler(exhandler interface{}, name string, engine string, service string, mSetting map[string]string, ext map[string]interface{}) dispatcher.HandlerFunc

ContextHandler api请求处理程序

func Delay

func Delay() dispatcher.HandlerFunc

Delay 处理请求的延时时长

Header 头设置

func Host

Host 处理服务器的主机头

func JwtAuth

JwtAuth jwt

func JwtWriter

func JwtWriter(cnf *conf.MetadataConf) dispatcher.HandlerFunc

func Logging

func Logging(conf *conf.MetadataConf) dispatcher.HandlerFunc

Logging 记录日志

func NoResponse

func NoResponse(conf *conf.MetadataConf) dispatcher.HandlerFunc

NoResponse 处理无响应的返回结果

func Recovery

func Recovery() dispatcher.HandlerFunc

Recovery returns a middleware that recovers from any panics and writes a 500 if there was one.

func RecoveryWithWriter

func RecoveryWithWriter() dispatcher.HandlerFunc

RecoveryWithWriter returns a middleware for a given writer that recovers from any panics and writes a 500 if there was one.

func Response

func Response(conf *conf.MetadataConf) dispatcher.HandlerFunc

Response 处理api返回值

Types

type HandlerFunc

type HandlerFunc func(ctx *dispatcher.Context)

func (HandlerFunc) Handle

func (h HandlerFunc) Handle(ctx *dispatcher.Context)

type HeaderData

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

func (HeaderData) Get

func (i HeaderData) Get(key string) (interface{}, bool)

Get 获取指定键对应的数据

func (HeaderData) Keys

func (i HeaderData) Keys() []string

Keys 获取所有KEY

type IHeaderData

type IHeaderData interface {
	Get(key string) (interface{}, bool)
	Keys() []string
}

InputData 输入参数

type IInputData

type IInputData interface {
	Get(key string) (interface{}, bool)
	Keys() []string
}

InputData 输入参数

type InputData

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

func (InputData) Get

func (i InputData) Get(key string) (interface{}, bool)

Get 获取指定键对应的数据

func (InputData) Keys

func (i InputData) Keys() []string

Keys 获取所有KEY

type Metric

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

Metric 服务器处理能力统计

func NewMetric

func NewMetric(conf *conf.MetadataConf) *Metric

NewMetric new metric

func (*Metric) Handle

func (m *Metric) Handle() dispatcher.HandlerFunc

Handle 处理请求

func (*Metric) Restart

func (m *Metric) Restart(host string, dataBase string, userName string, password string, c string,
	lg *logger.Logger) (err error)

Restart restart metric

func (*Metric) Stop

func (m *Metric) Stop()

Stop stop metric

type ParamData

type ParamData map[string]string

ParamData map参数数据

func (ParamData) Get

func (i ParamData) Get(key string) (interface{}, bool)

Get 获取指定键对应的数据

func (ParamData) Keys

func (i ParamData) Keys() []string

Keys 获取指定键对应的数据

Jump to

Keyboard shortcuts

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