refactor: openpitrix module

Signed-off-by: hongming <talonwan@yunify.com>
This commit is contained in:
hongming
2019-09-25 14:07:15 +08:00
parent d0dc66cf28
commit 1b5681c12b
314 changed files with 72092 additions and 25762 deletions

28
vendor/github.com/koding/multiconfig/multivalidator.go generated vendored Normal file
View File

@@ -0,0 +1,28 @@
package multiconfig
type multiValidator []Validator
// MultiValidator accepts variadic validators and satisfies Validator interface.
func MultiValidator(validators ...Validator) Validator {
return multiValidator(validators)
}
// Validate tries to validate given struct with all the validators. If it doesn't
// have any Validator it will simply skip the validation step. If any of the
// given validators return err, it will stop validating and return it.
func (d multiValidator) Validate(s interface{}) error {
for _, validator := range d {
if err := validator.Validate(s); err != nil {
return err
}
}
return nil
}
// MustValidate validates the struct, it panics if gets any error
func (d multiValidator) MustValidate(s interface{}) {
if err := d.Validate(s); err != nil {
panic(err)
}
}