validator

package
v0.0.0-...-c97fb91 Latest Latest
Warning

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

Go to latest
Published: Oct 12, 2020 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package validator can be used to return form validation errors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FieldError

type FieldError struct {
	Field  string
	Errors []error
}

FieldError for validation.

func NewFieldError

func NewFieldError(field string, err ...error) FieldError

NewFieldError for validation.

func (FieldError) Add

func (f FieldError) Add(err ...error)

Add field errors.

func (FieldError) Error

func (f FieldError) Error() string

Error message.

type FormError

type FormError []FieldError

FormError for validation.

func TemplateErrors

func TemplateErrors(err error) FormError

TemplateErrors returns a FormError with the form errors to be consumed in a template. If no errors exist, it returns an empty object.

func (FormError) Append

func (f FormError) Append(field string, err ...error) FormError

Append form error.

func (FormError) Error

func (f FormError) Error() string

Error message.

func (FormError) Get

func (f FormError) Get(field string) (FieldError, bool)

Get field errors.

Jump to

Keyboard shortcuts

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