Add Validator from github.com/go-playground/validator for LDAP config

Add error function to check if there are any parent error
This commit is contained in:
Nicolas JUHEL
2020-08-23 13:14:27 +02:00
parent 59070d0694
commit fbed8f5216
4 changed files with 40 additions and 7 deletions

View File

@@ -92,6 +92,7 @@ type Error interface {
IsError(e error) bool
HasError(err error) bool
HasParent() bool
AddParent(parent ...error)
SetParent(parent ...error)
@@ -243,6 +244,10 @@ func (e *errors) HasError(err error) bool {
return false
}
func (e *errors) HasParent() bool {
return len(e.p) > 0
}
func (e *errors) SetParent(parent ...error) {
e.p = make([]Error, 0)
e.AddParent(parent...)