Documentation ¶
Overview ¶
Gin request 请求参数
Gin response 响应参数
Index ¶
- Variables
- func JSONMarshalToString(v interface{}) string
- func ParseJSON(c *gin.Context, obj interface{}) error
- func ResponseErrorBody(c *gin.Context, msg interface{})
- func ResponseSuccessBody(c *gin.Context, msg, data interface{})
- func ResponseWarningBody(c *gin.Context, msg, data interface{})
- type CodeType
- type RateKeyFunc
- type RateLimiterMiddleware
- type ResponseError
Constants ¶
This section is empty.
Variables ¶
View Source
var ( JSONMarshal = json.Marshal JSONUnmarshal = json.Unmarshal JSONMarshalIndent = json.MarshalIndent JSONNewDecoder = json.NewDecoder JSONNewEncoder = json.NewEncoder )
定义JSON操作
Functions ¶
func JSONMarshalToString ¶
func JSONMarshalToString(v interface{}) string
JSONMarshalToString JSON编码为字符串
func ResponseErrorBody ¶
ResponseErrorBody 请求错误
func ResponseSuccessBody ¶
ResponseSuccessBody 请求成功
func ResponseWarningBody ¶
ResponseWarningBody 警告
Types ¶
type RateLimiterMiddleware ¶
type RateLimiterMiddleware struct {
// contains filtered or unexported fields
}
func NewRateLimiter ¶
func NewRateLimiter(interval time.Duration, capacity int64, keyGen RateKeyFunc) *RateLimiterMiddleware
func (*RateLimiterMiddleware) Middleware ¶
func (r *RateLimiterMiddleware) Middleware() gin.HandlerFunc
type ResponseError ¶
type ResponseError struct { Code CodeType `json:"code"` Msg interface{} `json:"msg"` Data interface{} `json:"data"` }
ResponseError 定义响应错误
Click to show internal directories.
Click to hide internal directories.