-
Hello everyone, I would like to ask whether it is currently possible to use built-in tags to complete the verification that something cannot exist and cannot not exist at the same time? |
Beta Was this translation helpful? Give feedback.
Answered by
onnttf
Jun 17, 2024
Replies: 1 comment
-
I'm happy to say that I've found a solution using the following code, which uses required_without and excluded_with at the same time. i := struct {
User string `json:"user" validate:"required_without=Role,excluded_with=Role"`
Role string `json:"role" validate:"required_without=User,excluded_with=User"`
Resource string `json:"resource" validate:"required,uri"`
Action string `json:"action" validate:"required"`
}{} |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
onnttf
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I'm happy to say that I've found a solution using the following code, which uses required_without and excluded_with at the same time.