govalidator
govalidator copied to clipboard
How to do struct validation for slice of strings
Hello, I have tried validating struct element which is slice of strings. I've tried using the following functions but somehow they don't work as expected: "range(min|max)": Range, "length(min|max)": ByteLength, "runelength(min|max)": RuneLength, "stringlength(min|max)": StringLength,
How can you say my slice cannot have more than 5 elements and each element cannot be more than 20 alpha characters? Can you do this with the validator and using struct tags?