package request import ( "git.sxidc.com/go-tools/api_binding/http_binding/binding_context" "git.sxidc.com/go-tools/api_binding/http_binding/response" "github.com/gin-gonic/gin/binding" "net/http" ) func BindingJson[O any](c *binding_context.Context, request any, sendFunc response.SendFunc[O]) bool { err := c.ShouldBindJSON(request) if err != nil { var zero O sendFunc(c, http.StatusBadRequest, zero, err) return false } return true } func BindingQuery[O any](c *binding_context.Context, query any, sendFunc response.SendFunc[O]) bool { err := c.ShouldBindQuery(query) if err != nil { var zero O sendFunc(c, http.StatusBadRequest, zero, err) return false } return true } func BindingMultipartForm[O any](c *binding_context.Context, request any, sendFunc response.SendFunc[O]) bool { err := c.ShouldBindWith(request, binding.FormMultipart) if err != nil { var zero O sendFunc(c, http.StatusBadRequest, zero, err) return false } return true }