Where communities thrive

  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
Repo info
Jeffery Utter
Hello. Anyone have any advice on how to validate a user struct with "password" and "encrypted_password" so that the password validation only runs if the encrypted one is set?
Markus Mahlberg
I think it does not work that way. The "problem" is that fields are validated independently. So even when you use the tagMap, synchronization would be pretty tricky. Furthermore, my thinking is that this is business logic and should belong to the handler(Func)/controller/service or however you have organized your application.
Kareem H
How do you access multiple validation errors?
Are you guys using Go also ? Just have 1 idea to validate encrypted_password that about the length
Markus Mahlberg
@LeVuVanThinh Why don't you validate the password the "old" way: on entering and again before you hash it (I sincerely hope you do not encrypt it).
sahil chug
is there any way to customise error messages using govalidator lib?
Markus Mahlberg
@twistedlog asaskevich/govalidator#121
Markus Mahlberg
@twistedlog Basically, you use a tilde after the validator in the struct tag: valid:"required~Your custom error message on zero value,length(4|10)~Your custom error message for length constraint violation"
sahil chug
Josh Reese
Howdy - I was wondering since it's been just about two months since the fix for #266 was added if a v10 release is in the works?
Brian Henderson
hi all, is there a way to validate that a slice is to be non empty?
Brian Henderson
looks like "required" already takes care of it!
Adrian Brad
hello, is it possible to validate a struct field against another field from the same struct?
Le Minh Tri
How to support i18n for the error messages on ParamValidator using https://github.com/nicksnyder/go-i18n? I cannot get validation params from the errors.
The custom function is not working, how can I improve the code?