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
When attempting to validate a map field using the .By() method, the data (in this case an array) passed to the function no longer exists, even when I pass my map to the .Map() method by reference. How do I fix this?
func validateMap(reminder map[string]interface{}) error {
fmt.Println("days:", reminder["days"])//This field, an array, is printed with all of its values in tac.
return validation.Validate(&reminder,
validation.Map(
validation.Key("days", validation.By(test)).Optional(),
),
)
}
func test(val interface{}) error{
v, _ := val.([]string)
fmt.Println("v:", v)//Here however, the array is empty.
return nil
}
The text was updated successfully, but these errors were encountered:
When attempting to validate a map field using the
.By()
method, the data (in this case an array) passed to the function no longer exists, even when I pass my map to the.Map()
method by reference. How do I fix this?The text was updated successfully, but these errors were encountered: