Accessing validation tag parameters of other tags in go-playground/validator #1118
edwynrrangel
started this conversation in
General
Replies: 1 comment
-
@edwynrrangel have you tried using |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I'm using the go-playground/validator package to validate a struct in Go. Here is my struct definition:
As you can see, the CreatedAtMin and CreatedAtMax fields have a custom date validation that defines the date format with the datetime tag. I'd like to use this same date format in another custom validation function. Here is the skeleton of my custom validation function:
Is there a way to access the parameter of the datetime validation tag of another field from within my custom validation function, such that I can use that format instead of having to hard-code it into the time.Parse function?
Any help or direction would be greatly appreciated. Thank you.
Beta Was this translation helpful? Give feedback.
All reactions