zgin

package
v0.0.0-...-e0d6b9e Latest Latest
Warning

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

Go to latest
Published: Jul 29, 2022 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Debug

func Debug(config *Config) gin.HandlerFunc

func Metric

func Metric(config *Config) gin.HandlerFunc

func RateLimit

func RateLimit(config *Config) gin.HandlerFunc

func SignalNotify

func SignalNotify(srv *Server)

func SysAuth

func SysAuth(config *Config) gin.HandlerFunc

Types

type BaseHandle

type BaseHandle struct{}

func (*BaseHandle) FailWithMessage

func (b *BaseHandle) FailWithMessage(c *gin.Context, message string)

func (*BaseHandle) OKWithData

func (b *BaseHandle) OKWithData(c *gin.Context, message string, data interface{})

func (*BaseHandle) OKWithMessage

func (b *BaseHandle) OKWithMessage(c *gin.Context, message string)

type Config

type Config struct {
	Address       string `json:"address" yaml:"address"`             //gin服务的启动地址
	Mode          string `json:"mode" yaml:"mode"`                   //gin的启动模式
	Debug         bool   `json:"debug" yaml:"debug"`                 //是否打印调试日志
	SecretKey     string `json:"secretKey" yaml:"secretKey"`         //内部系统调用的对称秘钥
	DisableMetric bool   `json:"disableMetric" yaml:"disableMetric"` //是否进行监控
	DisableTrace  bool   `json:"disableTrace" yaml:"disableTrace"`   //是否进行链路追踪
	RateLimit     int    `json:"rateLimit" yaml:"rateLimit"`         //限速
}

func DefaultConfig

func DefaultConfig() Config

type Context

type Context = gin.Context

type Engine

type Engine = gin.Engine

type ErrorType

type ErrorType uint64

ErrorType is an unsigned 64-bit error code as defined in the gin spec.

const (
	// ErrorTypeBind is used when Context.Bind() fails.
	ErrorTypeBind ErrorType = 1 << 63
	// ErrorTypeRender is used when Context.Render() fails.
	ErrorTypeRender ErrorType = 1 << 62
	// ErrorTypePrivate indicates a private error.
	ErrorTypePrivate ErrorType = 1 << 0
	// ErrorTypePublic indicates a public error.
	ErrorTypePublic ErrorType = 1 << 1
	// ErrorTypeAny indicates any other error.
	ErrorTypeAny ErrorType = 1<<64 - 1
	// ErrorTypeNu indicates any other error.
	ErrorTypeNu = 2
)

type HandlerFunc

type HandlerFunc = gin.HandlerFunc

type Server

type Server struct {
	*gin.Engine

	Server *http.Server
	// contains filtered or unexported fields
}

func NEW

func NEW(config *Config) *Server

Jump to

Keyboard shortcuts

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