FieldError contains all functions to get error details
| 74 | |
| 75 | // FieldError contains all functions to get error details |
| 76 | type FieldError interface { |
| 77 | |
| 78 | // Tag returns the validation tag that failed. if the |
| 79 | // validation was an alias, this will return the |
| 80 | // alias name and not the underlying tag that failed. |
| 81 | // |
| 82 | // eg. alias "iscolor": "hexcolor|rgb|rgba|hsl|hsla" |
| 83 | // will return "iscolor" |
| 84 | Tag() string |
| 85 | |
| 86 | // ActualTag returns the validation tag that failed, even if an |
| 87 | // alias the actual tag within the alias will be returned. |
| 88 | // If an 'or' validation fails the entire or will be returned. |
| 89 | // |
| 90 | // eg. alias "iscolor": "hexcolor|rgb|rgba|hsl|hsla" |
| 91 | // will return "hexcolor|rgb|rgba|hsl|hsla" |
| 92 | ActualTag() string |
| 93 | |
| 94 | // Namespace returns the namespace for the field error, with the tag |
| 95 | // name taking precedence over the field's actual name. |
| 96 | // |
| 97 | // eg. JSON name "User.fname" |
| 98 | // |
| 99 | // See StructNamespace() for a version that returns actual names. |
| 100 | // |
| 101 | // NOTE: this field can be blank when validating a single primitive field |
| 102 | // using validate.Field(...) as there is no way to extract it's name |
| 103 | Namespace() string |
| 104 | |
| 105 | // StructNamespace returns the namespace for the field error, with the field's |
| 106 | // actual name. |
| 107 | // |
| 108 | // eg. "User.FirstName" see Namespace for comparison |
| 109 | // |
| 110 | // NOTE: this field can be blank when validating a single primitive field |
| 111 | // using validate.Field(...) as there is no way to extract its name |
| 112 | StructNamespace() string |
| 113 | |
| 114 | // Field returns the field's name with the tag name taking precedence over the |
| 115 | // field's actual name. |
| 116 | // |
| 117 | // `RegisterTagNameFunc` must be registered to get tag value. |
| 118 | // |
| 119 | // eg. JSON name "fname" |
| 120 | // see StructField for comparison |
| 121 | Field() string |
| 122 | |
| 123 | // StructField returns the field's actual name from the struct, when able to determine. |
| 124 | // |
| 125 | // eg. "FirstName" |
| 126 | // see Field for comparison |
| 127 | StructField() string |
| 128 | |
| 129 | // Value returns the actual field's value in case needed for creating the error |
| 130 | // message |
| 131 | Value() interface{} |
| 132 | |
| 133 | // Param returns the param value, in string form for comparison; this will also |
no outgoing calls
no test coverage detected
searching dependent graphs…