govalidator
govalidator copied to clipboard
[Go] Package of validators and sanitizers for strings, numerics, slices and structs
Hello! I'm using this package to validate URLs before inserting it on a DB of a url Shortener, but when moving my shortener to another package I wanted to use...
Hello, I have an use case that I'd like to validate that a value is a valid regular expression. I have two short questions before I contribute: - It does...
Not sure if this is in the scope of the project, but it would be useful to have an accurate way to count grapheme clusters, and I don't know another...
I deal with json that sometimes comes as an array. I would like to be able to validate an array. Instead of having to make a helper function that uses...
Sorry about my English. Structure Validation returns a unique string separating errors by semicolons. It would be best to return an array of errors. **Today I'm having to do:** ```golang...
I would like to add the ability to trim input before validating inside govalidator.ValidateStruct(). There could be a sanitizer map that is run in govalidator.ValidateStruct() before the Validators are run...
**Example JSON** `{"ip":["1.1.1.1","1.1.1.2"]}` **How to create struct/rule?** `type Example struct { IPs []string `valid:"ipv4" json:"ip"` }` OR `type Example struct { IPs []string `valid:"[]ipv4" json:"ip"` }` How can I validate...
I am trying to use govalidator in one of my projects but struggling to implement validator for password confirmation: ```go type UserForm struct { Email string `valid:"required,email"` Password string `valid:"required,confirmation(PasswordConfirmation)"`...
Example type User struct { Email string ` valid:"matches(^.+\@.+\..+$)"` Password string `valid:"-"` } _, err := govalidator.ValidateStruct(user) if err != nil { log.Println(err.Error()) } regex doesnt work properly. It matches...
When `govalidator.SetFieldsRequiredByDefault` is enabled, the error message for an unset field is misleading. It reports "validation missing" for any validation except `valid:"-"`: ``` All fields are required to at least...