validation

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 18, 2021 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New(field, msg string) error

New returns a single validation error for the field with msg.

Types

type Errors

type Errors map[string]Messages //nolint: errname

Errors maps fields to the list of validation failures.

func (*Errors) Add

func (ee *Errors) Add(field, msg string) *Errors

Add appends the field and msg to the current list of errors. Add will initialize the Errors object if it is not initialized.

func (Errors) Error

func (ee Errors) Error() string

Error returns the error string of Errors.

func (*Errors) GetErr

func (ee *Errors) GetErr() error

GetErr allows you to use a nil Errors object and return directly. If there are no validation errors it returns nil.

type Messages

type Messages []string //nolint: errname

Messages are the validation failures for a given field.

func (Messages) Error

func (mm Messages) Error() string

Jump to

Keyboard shortcuts

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