-
I have |
Beta Was this translation helpful? Give feedback.
Answered by
zemzale
Mar 17, 2022
Replies: 1 comment 1 reply
-
Depends on what are the requirements for the username. But lets say its supposed to be only alphanumerics it would looks something like type Req struct {
Login string `validate:"required,email|alphanum"`
} You can read more about other validations in docs |
Beta Was this translation helpful? Give feedback.
1 reply
Answer selected by
ysomad
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Depends on what are the requirements for the username. But lets say its supposed to be only alphanumerics it would looks something like
You can read more about other validations in docs
https://pkg.go.dev/github.com/go-playground/validator/v10#hdr-Using_Validator_Tags