Documentation ¶
Index ¶
- type Client
- type GinHandle
- func (*GinHandle) DefaultQuery(c *gin.Context, key string, defaultValue string) string
- func (*GinHandle) FormFile(c *gin.Context, key string) (*multipart.FileHeader, error)
- func (*GinHandle) Param(c *gin.Context, key string) string
- func (*GinHandle) Query(c *gin.Context, key string) string
- func (*GinHandle) RequestFormFile(c *gin.Context, key string) (multipart.File, *multipart.FileHeader, error)
- func (*GinHandle) RetuenOk(c *gin.Context, data interface{})
- func (*GinHandle) ReturnErr(c *gin.Context, r *replyx.T)
- func (*GinHandle) ReturnJSON(c *gin.Context, code int, data interface{})
- func (*GinHandle) ShouldBind(c *gin.Context, s interface{}) error
- func (*GinHandle) ShouldBindJSON(c *gin.Context, s interface{}) error
- func (*GinHandle) ShouldBindUri(c *gin.Context, s interface{}) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type GinHandle ¶ added in v0.0.4
type GinHandle struct{}
func (*GinHandle) DefaultQuery ¶ added in v0.0.4
DefaultQuery 获取get参数,如果没有则返回默认值 例如:/user?name=xxx => DefaultQuery(c, "name", "default")
func (*GinHandle) RequestFormFile ¶ added in v0.5.0
func (*GinHandle) RequestFormFile(c *gin.Context, key string) (multipart.File, *multipart.FileHeader, error)
RequestFormFile 获取上传文件 例如:RequestFormFile(c, "file")
func (*GinHandle) RetuenOk ¶ added in v0.0.5
RetuenOk 返回成功json 例如:RetuenOk(c, data) => ReturnJSON(c, http.StatusOK, respx.Succ(data))
func (*GinHandle) ReturnErr ¶ added in v0.0.5
ReturnErr 返回错误json 例如:ReturnErr(c, respx.ParamErrT.ToPt()) => ReturnJSON(c, http.StatusBadRequest, respx.ParamErrT.ToPt())
func (*GinHandle) ReturnJSON ¶ added in v0.0.5
ReturnJSON 返回json 例如:ReturnJSON(c, http.StatusOK, respx.Succ(data))
func (*GinHandle) ShouldBind ¶ added in v0.0.4
ShouldBind Get绑定到结构体 例如:
type DemoGetReq struct { Id int `form:"id"` // 必须有form标签 }
var r req.DemoGetReq /user?name=xxx => ShouldBind(c, &r)
func (*GinHandle) ShouldBindJSON ¶ added in v0.0.4
ShouldBindJSON Post绑定到结构体 例如:
type DemoPostReq struct { Id int `json:"id"` // 必须有json标签,application/json }
var r req.DemoPostReq /user => ShouldBindJSON(c, &r)
Click to show internal directories.
Click to hide internal directories.