Versions in this module Expand all Collapse all v1 v1.1.2 Mar 30, 2026 Changes in this version + var ErrMaxDepth = errors.New("xgin.validator: maximum recursion depth exceeded") + var HookerAfterResponse func(ctx *gin.Context, response Response) + var HookerBeforeResponse func(ctx *gin.Context, response Response) (stop bool) + var HookerBindingError func(ctx *gin.Context, err error) + var HookerTransformResponse func(response Response) any + var ValidatorMaxDepth = 20 + func Handle[T any](h HandlerFunc[T]) gin.HandlerFunc + func SetHookerAfterResponse(h func(ctx *gin.Context, response Response)) + func SetHookerBeforeResponse(h func(ctx *gin.Context, response Response) (stop bool)) + func SetHookerBindingError(h func(ctx *gin.Context, err error)) + func SetHookerTransformResponse(h func(response Response) any) + func SetValidatorMaxDepth(depth int) + func Wrap(handler func(ctx *Context) Response) gin.HandlerFunc + type ContentType int8 + const ContentTypeAsciiJSON + const ContentTypeHTML + const ContentTypeIndentedJSON + const ContentTypeJSON + const ContentTypeJsonpJSON + const ContentTypeMsgPack + const ContentTypeProtoBuf + const ContentTypePureJSON + const ContentTypeRedirect + const ContentTypeSecureJSON + const ContentTypeString + const ContentTypeTOML + const ContentTypeXML + const ContentTypeYAML + type Context struct + func NewContext(c *gin.Context) *Context + func (c *Context) AutoBind(obj any) error + type HandlerFunc func(ctx *Context, req *T) Response + type IValidator interface + Validate func() error + type Response struct + Code int + ContentType ContentType + Data any + Errors []error + Header map[string]string + HtmlPath string + HttpStatus int + Msg string + func (r Response) WithCode(code int) Response + func (r Response) WithContentType(typ ContentType) Response + func (r Response) WithData(data any) Response + func (r Response) WithError(err error) Response + func (r Response) WithErrors(errors ...error) Response + func (r Response) WithHeader(key, val string) Response + func (r Response) WithHeaders(kv map[string]string) Response + func (r Response) WithHtmlPath(htmlPath string) Response + func (r Response) WithHttpStatus(status int) Response + func (r Response) WithMsg(msg string) Response + type Validator struct + func NewValidator(maxDepth int) *Validator + func SharedValidator(maxDepth int) *Validator + func (v *Validator) Validate(obj any) (err error) v1.1.1 Mar 20, 2026 v1.1.0 Mar 20, 2026 v1.0.13 Jun 28, 2022 v1.0.12 Jun 28, 2022 v1.0.11 Jun 28, 2022 v1.0.10 Jun 28, 2022 v1.0.9 Jun 28, 2022 v1.0.8 Jun 28, 2022 v1.0.7 Jun 28, 2022 v1.0.6 Jun 27, 2022 v1.0.5 Jun 27, 2022 v1.0.4 Jun 27, 2022 v1.0.2 Jun 24, 2022