|
|
|
@ -5,7 +5,6 @@ import "reflect" |
|
|
|
|
// FieldLevel contains all the information and helper functions
|
|
|
|
|
// to validate a field
|
|
|
|
|
type FieldLevel interface { |
|
|
|
|
|
|
|
|
|
// returns the top level struct, if any
|
|
|
|
|
Top() reflect.Value |
|
|
|
|
|
|
|
|
@ -26,6 +25,8 @@ type FieldLevel interface { |
|
|
|
|
// returns param for validation against current field
|
|
|
|
|
Param() string |
|
|
|
|
|
|
|
|
|
GetTag() string |
|
|
|
|
|
|
|
|
|
// ExtractType gets the actual underlying type of field value.
|
|
|
|
|
// It will dive into pointers, customTypes and return you the
|
|
|
|
|
// underlying value and it's kind.
|
|
|
|
@ -73,6 +74,11 @@ func (v *validate) FieldName() string { |
|
|
|
|
return v.cf.altName |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// GetTag returns the tag name of field
|
|
|
|
|
func (v *validate) GetTag() string { |
|
|
|
|
return v.ct.tag |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// StructFieldName returns the struct field's name
|
|
|
|
|
func (v *validate) StructFieldName() string { |
|
|
|
|
return v.cf.name |
|
|
|
|