Files
core/valid/field_level.go
T

16 lines
530 B
Go
Raw Normal View History

package valid
import "reflect"
// FieldLevel provides access to the field being validated.
// It is passed to custom validator functions registered via WithCustomValidator.
type FieldLevel interface {
// Field returns the reflect.Value of the field being validated.
Field() reflect.Value
// Param returns the tag parameter, if any.
// For validate:"mytag=value", Param() returns "value"; otherwise "".
Param() string
// FieldName returns the field name used for error messages (json tag or Go name).
FieldName() string
}