mirror of
https://github.com/gin-gonic/gin.git
synced 2026-06-04 09:48:17 +08:00
Merge 1c24d1950da99103741b272a718598e73f628273 into d3ffc9985281dcf4d3bef604cce4e662b1a327a6
This commit is contained in:
commit
2ee732647f
@ -71,18 +71,18 @@ var Validator StructValidator = &defaultValidator{}
|
|||||||
// These implement the Binding interface and can be used to bind the data
|
// These implement the Binding interface and can be used to bind the data
|
||||||
// present in the request to struct instances.
|
// present in the request to struct instances.
|
||||||
var (
|
var (
|
||||||
JSON = jsonBinding{}
|
JSON = jsonBinding{}
|
||||||
XML = xmlBinding{}
|
XML = xmlBinding{}
|
||||||
Form = formBinding{}
|
Form = formBinding{}
|
||||||
Query = queryBinding{}
|
Query = queryBinding{}
|
||||||
FormPost = formPostBinding{}
|
FormPost = formPostBinding{}
|
||||||
FormMultipart = formMultipartBinding{}
|
FormMultipart = formMultipartBinding{}
|
||||||
ProtoBuf = protobufBinding{}
|
ProtoBuf = protobufBinding{}
|
||||||
YAML = yamlBinding{}
|
YAML = yamlBinding{}
|
||||||
Uri = uriBinding{}
|
Uri = uriBinding{}
|
||||||
Header = headerBinding{}
|
Header = headerBinding{}
|
||||||
TOML = tomlBinding{}
|
TOML = tomlBinding{}
|
||||||
Plain = plainBinding{}
|
Plain = plainBinding{}
|
||||||
BSON BindingBody = bsonBinding{}
|
BSON BindingBody = bsonBinding{}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|||||||
@ -27,12 +27,12 @@ func (err SliceValidationError) Error() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
var b strings.Builder
|
var b strings.Builder
|
||||||
for i := range len(err) {
|
for i, e := range err {
|
||||||
if err[i] != nil {
|
if e != nil {
|
||||||
if b.Len() > 0 {
|
if b.Len() > 0 {
|
||||||
b.WriteString("\n")
|
b.WriteString("\n")
|
||||||
}
|
}
|
||||||
b.WriteString("[" + strconv.Itoa(i) + "]: " + err[i].Error())
|
b.WriteString("[" + strconv.Itoa(i) + "]: " + e.Error())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return b.String()
|
return b.String()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user