Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
Jeffery Utter
@jeffutter
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
@mwmahlberg
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
@magicalbanana
How do you access multiple validation errors?
vanthinh
@thinhlvv
Are you guys using Go also ? Just have 1 idea to validate encrypted_password that about the length
Markus Mahlberg
@mwmahlberg
vanth
@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
@twistedlog
is there any way to customise error messages using govalidator lib?
Markus Mahlberg
@mwmahlberg
@twistedlog asaskevich/govalidator#121
Markus Mahlberg
@mwmahlberg
@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
@twistedlog
Thanks.
kk
@talmr-k
hi
Josh Reese
@joshlreese
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
@bhenderson
hi all, is there a way to validate that a slice is to be non empty?
Brian Henderson
@bhenderson
looks like "required" already takes care of it!
Adrian Brad
@adrianbrad
hello, is it possible to validate a struct field against another field from the same struct?