@@ -5,24 +5,25 @@ import "reflect"
55// FieldLevel contains all the information and helper functions
66// to validate a field
77type FieldLevel interface {
8- // returns the top level struct, if any
8+
9+ // Top returns the top level struct, if any
910 Top () reflect.Value
1011
11- // returns the current fields parent struct, if any or
12+ // Parent returns the current fields parent struct, if any or
1213 // the comparison value if called 'VarWithValue'
1314 Parent () reflect.Value
1415
15- // returns current field for validation
16+ // Field returns current field for validation
1617 Field () reflect.Value
1718
18- // returns the field's name with the tag
19+ // FieldName returns the field's name with the tag
1920 // name taking precedence over the fields actual name.
2021 FieldName () string
2122
22- // returns the struct field's name
23+ // StructFieldName returns the struct field's name
2324 StructFieldName () string
2425
25- // returns param for validation against current field
26+ // Param returns param for validation against current field
2627 Param () string
2728
2829 // GetTag returns the current validations tag name
@@ -33,7 +34,7 @@ type FieldLevel interface {
3334 // underlying value and it's kind.
3435 ExtractType (field reflect.Value ) (value reflect.Value , kind reflect.Kind , nullable bool )
3536
36- // traverses the parent struct to retrieve a specific field denoted by the provided namespace
37+ // GetStructFieldOK traverses the parent struct to retrieve a specific field denoted by the provided namespace
3738 // in the param and returns the field, field kind and whether is was successful in retrieving
3839 // the field at all.
3940 //
@@ -49,15 +50,15 @@ type FieldLevel interface {
4950 // Deprecated: Use GetStructFieldOKAdvanced2() instead which also return if the value is nullable.
5051 GetStructFieldOKAdvanced (val reflect.Value , namespace string ) (reflect.Value , reflect.Kind , bool )
5152
52- // traverses the parent struct to retrieve a specific field denoted by the provided namespace
53+ // GetStructFieldOK2 traverses the parent struct to retrieve a specific field denoted by the provided namespace
5354 // in the param and returns the field, field kind, if it's a nullable type and whether is was successful in retrieving
5455 // the field at all.
5556 //
5657 // NOTE: when not successful ok will be false, this can happen when a nested struct is nil and so the field
5758 // could not be retrieved because it didn't exist.
5859 GetStructFieldOK2 () (reflect.Value , reflect.Kind , bool , bool )
5960
60- // GetStructFieldOKAdvanced is the same as GetStructFieldOK except that it accepts the parent struct to start looking for
61+ // GetStructFieldOKAdvanced2 is the same as GetStructFieldOK except that it accepts the parent struct to start looking for
6162 // the field and namespace allowing more extensibility for validators.
6263 GetStructFieldOKAdvanced2 (val reflect.Value , namespace string ) (reflect.Value , reflect.Kind , bool , bool )
6364}
@@ -107,12 +108,12 @@ func (v *validate) GetStructFieldOKAdvanced(val reflect.Value, namespace string)
107108 return current , kind , found
108109}
109110
110- // GetStructFieldOK returns Param returns param for validation against current field
111+ // GetStructFieldOK2 returns Param returns param for validation against current field
111112func (v * validate ) GetStructFieldOK2 () (reflect.Value , reflect.Kind , bool , bool ) {
112113 return v .getStructFieldOKInternal (v .slflParent , v .ct .param )
113114}
114115
115- // GetStructFieldOKAdvanced is the same as GetStructFieldOK except that it accepts the parent struct to start looking for
116+ // GetStructFieldOKAdvanced2 is the same as GetStructFieldOK except that it accepts the parent struct to start looking for
116117// the field and namespace allowing more extensibility for validators.
117118func (v * validate ) GetStructFieldOKAdvanced2 (val reflect.Value , namespace string ) (reflect.Value , reflect.Kind , bool , bool ) {
118119 return v .getStructFieldOKInternal (val , namespace )
0 commit comments