Good day! I gave a config file:
type Config struct {
SettingsID *string `mapstructure:"settingsId" validate:"required"`
}
I use go-playground/validator/v10 for struct validation.
My SettingsID field can have only letters (a-z), numbers(0-9), can have only some symbols ( _ - \ ) and to be in lower case.
Now I check it via regexp [a-z0-9_-] and it works fine. But is there a way to check it via struct tags? I wanted to do something like
SettingsID *string `mapstructure:"settingsId" validate:"required,lowercase,alphanum,containsany=_\\-"`
But it doesnt work - containsany tells that a string MUST contain some of the symbols, etc.
Is there a way to make validation work via tags?