validate
validate copied to clipboard
⚔ Go package for data validation and filtering. support Map, Struct, Form data. Go通用的数据验证与过滤库,使用简单,内置大部分常用验证、过滤器,支持自定义验证器、自定义消息、字段翻译。
如题 type A struct { a []B `validate:"required"` } type B struct { b xxx `validate:"required,validateb"` } 应该如何修改 A.a 的tag来调用b的验证函数validateb呢
**System (please complete the following information):** - OS: `macOS` - GO Version: `1.18` - Pkg Version: `1.5.1` **Describe the bug** POST 请求中,一个 key 包含多个上传文件时,除了第一个文件,其他文件被丢弃。导致 `BindSafeData` 只能绑定 `File *multipart.FileHeader` 类型,而无法绑定 `File...
Add benchmark comparison with `github.com/go-playground/validator`
**System (please complete the following information):** - OS: `macOS` - GO Version: `1.20` - Pkg Version: `1.4.6` **Describe the bug** Nested resources are evaluated differently. This is super confusing and...
怎么实现从一个map数据源,使用Struct里定义好的规则来校验数据的有效性?同时要校验成功后,可以把map的数据绑定到struct中? 主要的场景是在request中,需要将请求的数据绑定到定义好的struct中,绑定时使用struct中的规则来绑定,不符合就返回err,符合就绑定。
**System (please complete the following information):** - OS: `linux` - GO Version: `1.20` - Pkg Version: `1.4.6` **Describe the bug** Not necessarily a bug. How exactly does `required` work? Suppose...
**System (please complete the following information):** - OS: `linux` - GO Version: `1.19` - Pkg Version: `v1.4.5` **Improvement:** It would be useful to have the original value in the final...
Is there a way to return the field that failed the validation when using `StopOnError=true` for example ```go d := &SomeStruct{ Name: "John" Email: "not an email" } v :=...
**System (please complete the following information):** - OS: `linux` [e.g. linux, macOS] - GO Version: `1.22` [e.g. `1.13`] - Pkg Version: `1.5.2` [e.g. `1.1.1`] **Describe the bug** filter 无法对切片中的元素应用,报错: `_filter:...