Open
Description
struct
type Request struct {
Name string `json:"name" validate:"optional_not_empty"`
Email string `json:"email"`
}
How Customize one optional_not_empty
to achieve the following results?
cases
testCases := []Request{
{ Email: ""}, // The Name field is not inpassed, and the verification is passed
{Name: "John", Email: ""}, // Name is passed in and the verification passes
{Name: "", Email: ""}, // Name is passed in, but the value is blank and the verification fails
}