Documentation ¶
Index ¶
- Constants
- func Debug(config *Config) gin.HandlerFunc
- func Metric(config *Config) gin.HandlerFunc
- func RateLimit(config *Config) gin.HandlerFunc
- func SignalNotify(srv *Server)
- func SysAuth(config *Config) gin.HandlerFunc
- func Trace(config *Config) gin.HandlerFunc
- type BaseHandler
- func (h *BaseHandler) ParamsException(c *gin.Context, err error)
- func (h *BaseHandler) Response(c *gin.Context, data ...interface{})
- func (h *BaseHandler) ResponseList(c *gin.Context, msg string, data ...interface{})
- func (h *BaseHandler) ResponseWithData(c *gin.Context, data interface{})
- func (h *BaseHandler) ServiceException(c *gin.Context, err error)
- type Config
- type Context
- type Engine
- type ErrorType
- type Response
- type ResponseBodyWriter
- type RouterGroup
- type Server
- type SysHandler
- func (s *SysHandler) ParamsException(c *gin.Context, msg string, err error)
- func (s *SysHandler) Response(c *gin.Context, data ...interface{})
- func (s *SysHandler) ResponseList(c *gin.Context, msg string, data ...interface{})
- func (s *SysHandler) ResponseWithData(c *gin.Context, data interface{})
- func (s *SysHandler) ServiceException(c *gin.Context, msg string, err error)
Constants ¶
View Source
const ( Success = "S" Fail = "F" )
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
func Trace ¶
func Trace(config *Config) gin.HandlerFunc
Types ¶
type BaseHandler ¶
type BaseHandler struct{}
func (*BaseHandler) ParamsException ¶
func (h *BaseHandler) ParamsException(c *gin.Context, err error)
func (*BaseHandler) Response ¶
func (h *BaseHandler) Response(c *gin.Context, data ...interface{})
func (*BaseHandler) ResponseList ¶
func (h *BaseHandler) ResponseList(c *gin.Context, msg string, data ...interface{})
func (*BaseHandler) ResponseWithData ¶
func (h *BaseHandler) ResponseWithData(c *gin.Context, data interface{})
func (*BaseHandler) ServiceException ¶
func (h *BaseHandler) ServiceException(c *gin.Context, err error)
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 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 ResponseBodyWriter ¶
type ResponseBodyWriter struct { gin.ResponseWriter Body *bytes.Buffer }
ResponseBodyWriter 为了获取接口返回信息进行双写
type RouterGroup ¶
type RouterGroup = gin.RouterGroup
type SysHandler ¶
type SysHandler struct{}
func (*SysHandler) ParamsException ¶
func (s *SysHandler) ParamsException(c *gin.Context, msg string, err error)
func (*SysHandler) Response ¶
func (s *SysHandler) Response(c *gin.Context, data ...interface{})
func (*SysHandler) ResponseList ¶
func (s *SysHandler) ResponseList(c *gin.Context, msg string, data ...interface{})
func (*SysHandler) ResponseWithData ¶
func (s *SysHandler) ResponseWithData(c *gin.Context, data interface{})
func (*SysHandler) ServiceException ¶
func (s *SysHandler) ServiceException(c *gin.Context, msg string, err error)
Click to show internal directories.
Click to hide internal directories.