Documentation ¶
Index ¶
- Constants
- func ServiceHandler(serviceFunc ServiceFunc, reqVal interface{}, respFactory ServiceRespFactory) func(*gin.Context)
- type DefaultServiceRespFactory
- type DefaultServiceResponse
- type Errorx3
- type LimitConn
- type LimitKeyFunc
- type LimitReq
- type ServiceFunc
- type ServiceRespFactory
- type ServiceResponse
Constants ¶
View Source
const ( Success = 0 // 成功 Unknown = -1 // 未知错误 WrongArgs = -2 // 参数错误 )
Variables ¶
This section is empty.
Functions ¶
func ServiceHandler ¶
func ServiceHandler(serviceFunc ServiceFunc, reqVal interface{}, respFactory ServiceRespFactory) func(*gin.Context)
Types ¶
type DefaultServiceRespFactory ¶ added in v1.0.19
type DefaultServiceRespFactory struct { }
func (*DefaultServiceRespFactory) IsJsonResponse ¶ added in v1.0.19
func (t *DefaultServiceRespFactory) IsJsonResponse(data interface{}) bool
func (*DefaultServiceRespFactory) NewDataResponse ¶ added in v1.0.19
func (t *DefaultServiceRespFactory) NewDataResponse(data interface{}, tag string) ServiceResponse
func (*DefaultServiceRespFactory) NewErrRespWithCode ¶ added in v1.0.19
func (t *DefaultServiceRespFactory) NewErrRespWithCode(code int, err error, data interface{}, tag string) ServiceResponse
type DefaultServiceResponse ¶
type DefaultServiceResponse struct { Code int `json:"code"` Msg string `json:"msg"` Tag string `json:"tag,omitempty"` Data interface{} `json:"data"` }
func (*DefaultServiceResponse) GetCode ¶ added in v1.0.16
func (t *DefaultServiceResponse) GetCode() int
func (*DefaultServiceResponse) GetMsg ¶ added in v1.0.19
func (t *DefaultServiceResponse) GetMsg() string
type LimitConn ¶
type LimitConn struct {
// contains filtered or unexported fields
}
func NewLimitConn ¶
func NewLimitConn(keyFunc LimitKeyFunc) *LimitConn
func (*LimitConn) Incoming ¶
func (l *LimitConn) Incoming(keyFunc LimitKeyFunc, max, burst int) gin.HandlerFunc
func (*LimitConn) Leaving ¶
func (l *LimitConn) Leaving(keyFunc LimitKeyFunc) gin.HandlerFunc
type LimitReq ¶
type LimitReq struct {
// contains filtered or unexported fields
}
func NewLimitReq ¶
func NewLimitReq(keyFunc LimitKeyFunc) *LimitReq
func (*LimitReq) Incoming ¶
func (l *LimitReq) Incoming(keyFunc LimitKeyFunc, rate float64, burst int) gin.HandlerFunc
type ServiceFunc ¶
type ServiceRespFactory ¶ added in v1.0.19
type ServiceRespFactory interface { IsJsonResponse(data interface{}) bool NewErrRespWithCode(code int, err error, data interface{}, tag string) ServiceResponse NewDataResponse(data interface{}, tag string) ServiceResponse }
type ServiceResponse ¶
Click to show internal directories.
Click to hide internal directories.