feat(validation): add Label to error struct
This commit is contained in:
parent
05f624fe09
commit
fac100ff37
@ -58,7 +58,7 @@ type ValidFormer interface {
|
|||||||
|
|
||||||
// Error show the error
|
// Error show the error
|
||||||
type Error struct {
|
type Error struct {
|
||||||
Message, Key, Name, Field, Tmpl string
|
Message, Key, Name, Field, Tmpl, Label string
|
||||||
Value interface{}
|
Value interface{}
|
||||||
LimitValue interface{}
|
LimitValue interface{}
|
||||||
}
|
}
|
||||||
@ -292,6 +292,7 @@ func (v *Validation) apply(chk Validator, obj interface{}) *Result {
|
|||||||
Value: obj,
|
Value: obj,
|
||||||
Tmpl: MessageTmpls[Name],
|
Tmpl: MessageTmpls[Name],
|
||||||
LimitValue: chk.GetLimitValue(),
|
LimitValue: chk.GetLimitValue(),
|
||||||
|
Label: Label,
|
||||||
}
|
}
|
||||||
v.setError(err)
|
v.setError(err)
|
||||||
|
|
||||||
@ -324,6 +325,7 @@ func (v *Validation) AddError(key, message string) {
|
|||||||
Key: key,
|
Key: key,
|
||||||
Name: Name,
|
Name: Name,
|
||||||
Field: Field,
|
Field: Field,
|
||||||
|
Label: Label,
|
||||||
}
|
}
|
||||||
v.setError(err)
|
v.setError(err)
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user