You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeUserstruct {
NamestringCars []Car
}
typeCarstruct {
IDintNamestring
}
func (vUser) Validate() error {
returnvalidation.ValidateStruct(&v,
validation.Field(&v.Name, validation.Required),
validation.Field(&v.Cars, validation.Length(1, 0)), // car's validation is triggered here... But I don't really care... How can I skip it
)
}
func (cCar) Validate() error {
returnvalidation.ValidateStruct(&c,
validation.Field(&c.Name, validation.Required),
)
}
As of the documentation, Car struct implements the Validatable interface. Hence, it will be .Validate() will be called. But what if I want to skip it? Just the validation.Length().
Thank you so much.
The text was updated successfully, but these errors were encountered:
I wanted to validate a struct. For example:
As of the documentation,
Car
struct implements theValidatable
interface. Hence, it will be.Validate()
will be called. But what if I want to skip it? Just thevalidation.Length()
.Thank you so much.
The text was updated successfully, but these errors were encountered: