middleware

package
v0.13.6-0...-d3ad96a Latest Latest
Warning

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

Go to latest
Published: Sep 7, 2020 License: MIT Imports: 37 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 APIResponse

func APIResponse(xconf *conf.MetadataConf) gin.HandlerFunc

APIResponse 处理api返回值

func AjaxRequest

func AjaxRequest(cnf *conf.MetadataConf) gin.HandlerFunc

AjaxRequest ajax请求限制

func Body

func Body() gin.HandlerFunc

Body 处理请求的body参数

func CircuitBreak

func CircuitBreak(conf *conf.MetadataConf) gin.HandlerFunc

CircuitBreak 熔断处理

func ContextHandler

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

ContextHandler api请求处理程序

func Delay

func Delay() gin.HandlerFunc

Delay 处理请求的延时时长

func Header(cnf *conf.MetadataConf) gin.HandlerFunc

Header 头设置

func Host

func Host(cnf *conf.MetadataConf) gin.HandlerFunc

Host 处理服务器的主机头

func JwtAuth

func JwtAuth(cnf *conf.MetadataConf) gin.HandlerFunc

JwtAuth jwt

func JwtWriter

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

func Logging

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

Logging 记录日志

func MustStatic

func MustStatic(s *conf.Static, rPath string) (b bool, xname string)

MustStatic 判断当前文件是否一定是静态文件 0:非静态文件 1:是静态文件 2:未知

func Recovery

func Recovery() gin.HandlerFunc

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

func RecoveryWithWriter

func RecoveryWithWriter() gin.HandlerFunc

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

func Static

func Static(cnf *conf.MetadataConf) gin.HandlerFunc

Static 静态文件处理插件

func WSContextHandler

func WSContextHandler(exhandler interface{}, name string, engine string, service string, mSetting map[string]string) gin.HandlerFunc

WSContextHandler api请求处理程序

func WebResponse

func WebResponse(conf *conf.MetadataConf) gin.HandlerFunc

WebResponse 处理web返回值

Types

type HandlerFunc

type HandlerFunc func(ctx *gin.Context)

func (HandlerFunc) Handle

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

type Hub

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

Hub maintains the set of active clients and broadcasts messages to the clients.

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 MapData

type MapData map[string]interface{}

func (MapData) Get

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

Get 获取指定键对应的数据

func (MapData) Keys

func (i MapData) Keys() []string

Keys 获取指定键对应的数据

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() gin.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