Documentation ¶
Index ¶
- Constants
- Variables
- func Bing(c *gin.Context, obj interface{}) (err error)
- func BingFile(c *gin.Context, name ...string) (file *multipart.FileHeader, err error)
- func BingForm(c *gin.Context, obj interface{}) (err error)
- func BingJson(c *gin.Context, obj interface{}) (err error)
- func BingQuery(c *gin.Context, obj interface{}) (err error)
- func BingUri(c *gin.Context, obj interface{}) (err error)
- func NewPageReq() *dao.PageRequest
- type GinRequest
- func (g *GinRequest) BingFile(c *gin.Context, name ...string) (file *multipart.FileHeader, err error)
- func (g *GinRequest) GetValidateErrMessage(err error, obj interface{}) string
- func (g *GinRequest) NewPageOptions() *dao.PageRequest
- func (g *GinRequest) Translate(err error) map[string][]string
- func (g *GinRequest) TranslateToMap(tag string, err error, obj interface{}) map[string][]string
- func (g *GinRequest) TranslateToString(tag string, err error, obj interface{}) string
- type ListRequest
- type ListResponse
- type Validate
Constants ¶
View Source
const (
// FileNotExist 文件不存在
FileNotExist = "file not exist"
)
Variables ¶
View Source
var ValidateTags = []string{"json", "form", "query", "uri", "header"}
Functions ¶
Types ¶
type GinRequest ¶ added in v0.0.5
type GinRequest struct {
// contains filtered or unexported fields
}
func NewGinRequest ¶ added in v0.0.5
func NewGinRequest(c *gin.Context) *GinRequest
func (*GinRequest) BingFile ¶ added in v0.0.5
func (g *GinRequest) BingFile(c *gin.Context, name ...string) (file *multipart.FileHeader, err error)
BingFile file参数验证器
func (*GinRequest) GetValidateErrMessage ¶ added in v0.1.4
func (g *GinRequest) GetValidateErrMessage(err error, obj interface{}) string
GetValidateErrMessage 获取校验错误信息 传入错误对象和对象 对象tag为json form uri query header
func (*GinRequest) NewPageOptions ¶ added in v0.0.5
func (g *GinRequest) NewPageOptions() *dao.PageRequest
NewPageOptions 获取分页options
func (*GinRequest) Translate ¶ added in v0.0.5
func (g *GinRequest) Translate(err error) map[string][]string
Translate TranslateToMap Translate 翻译错误信息
func (*GinRequest) TranslateToMap ¶ added in v0.0.5
func (g *GinRequest) TranslateToMap(tag string, err error, obj interface{}) map[string][]string
TranslateToMap Translate 翻译错误信息 tag 为结构体的tag定义的验证字段来源 如:json form uri query 返回所有验证错误信息的map
func (*GinRequest) TranslateToString ¶ added in v0.0.5
func (g *GinRequest) TranslateToString(tag string, err error, obj interface{}) string
TranslateToString tag 为结构体的tag定义的验证字段来源 如:json form uri query 返回第一条验证错误信息的字符串
type ListRequest ¶
type ListRequest struct { Page int `form:"page" json:"page" query:"page" binding:"omitempty,min=1" msg:"页码最小为1" ` PageSize int `form:"page_size" json:"page_size" query:"page_size" binding:"omitempty,min=1" msg:"每页数量最小为1" ` Order string `form:"order" json:"order" query:"order" msg:"排序" ` Field string `form:"field" json:"field" query:"field" msg:"排序字段" ` }
ListRequest 列表请求参数
type ListResponse ¶
ListResponse 列表响应参数
type Validate ¶ added in v0.1.2
type Validate struct {
// contains filtered or unexported fields
}
func NewValidate ¶ added in v0.1.2
func NewValidate() *Validate
Click to show internal directories.
Click to hide internal directories.