validator

package
v0.10.6 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 24, 2021 License: Apache-2.0 Imports: 1 Imported by: 9

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Validator

type Validator interface {
	// Validate takes a list of arbitrary objects and returns a slice of results,
	// one for each object validated.
	Validate(...interface{}) []errors.ManifestResult
	// WithValidators returns a Validator appended to a variable number of
	// Validator's.
	WithValidators(...Validator) Validators
}

Validator is an interface for validating arbitrary objects.

type ValidatorFunc

type ValidatorFunc func(...interface{}) []errors.ManifestResult

ValidatorFunc implements Validator. ValidatorFunc can be used as a wrapper for functions that run object validators.

func (ValidatorFunc) Validate

func (f ValidatorFunc) Validate(objs ...interface{}) (results []errors.ManifestResult)

Validate runs the ValidatorFunc on objs.

func (ValidatorFunc) WithValidators

func (f ValidatorFunc) WithValidators(vals ...Validator) Validators

WithValidators appends the ValidatorFunc to vals.

type Validators

type Validators []Validator

Validators is a set of Validator's that implements Validate.

func (Validators) Validate

func (validators Validators) Validate(objs ...interface{}) (results []errors.ManifestResult)

Validate invokes each Validator in Validators, collecting and returning the results.

func (Validators) WithValidators

func (validators Validators) WithValidators(vals ...Validator) Validators

WithValidators appends vals to Validators.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL