validation

package
v0.22.0 Latest Latest
Warning

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

Go to latest
Published: Jun 7, 2019 License: Apache-2.0 Imports: 3 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddPrefix

func AddPrefix(fieldPrefix string, err error) error

AddPrefix will prepend a prefix to all field names within the given error.

func IsValidationError

func IsValidationError(err error) bool

IsValidationError will determine if an error's cause is a field validation error.

Types

type FieldError

type FieldError interface {
	error
	Validation() bool
	Field() string
	Reason() string
}

A FieldError represents an invalid field during validation.

func NewFieldError

func NewFieldError(fieldName string, reason string) FieldError

NewFieldError will create a new FieldError for the given field and reason

type MultiFieldError

type MultiFieldError interface {
	error
	Validation() bool
	FieldErrors() []FieldError
}

func NewMultiFieldError

func NewMultiFieldError(errs []FieldError) MultiFieldError

NewMultiFieldError will combine multiple FieldErrors into a MultiFieldError.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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