govalid
govalid copied to clipboard
Govalid with Pointer Types is not possible
The govalid struct validation is only for non pointer types. Is there any reason for that? I think there a some great possibilities for pointers with govalid tags.
Is this already in planning? If not I can try to investigate further and maybe make a pull request
go version go1.16.2 windows/amd64
The govalid struct validation is only for non pointer types.
What exactly are you referring to here? The s argument here can be a pointer: func (v *Validator) Violation(s interface{}) (string, error).
Sorry for the late response:
type Test struct {
Name *string `govalid:"max:10`
}
I mean the above code. It will ignored if the Name Field is not 10 characters long, so it doesn´t matter how long the Name field is.
Or you have a code example where field pointer types are supported and actually working?
Thanks for the clarification. Sounds like a good thing to add. Feel free to make a PR for discussion.