gin Bind 参数绑定。
type params struct {
Total int `form:"total" json:"total" binding:"omitempty,numeric"`
}
Bind和ShouldBind 区别
区别就是Bindxxx
会的返回400
http状态码错误,而Shouldxxx
不会用户可以自定义错误码。
ShouldBind
绑定不是GET
请求的 json
参数,但可以绑定成功POST
请求的 json
参数。
ShouldBindJSON
绑定 json
参数。