validate

package
v0.4.3 Latest Latest
Warning

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

Go to latest
Published: Jun 24, 2018 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTagParsers

func AddTagParsers(parser tagParser)

AddTagParsers used in fieldName

func CheckErrors

func CheckErrors(opts Options) (ok bool, err error)

CheckErrors of validator and return formatted errors:

Types

type FieldError added in v0.4.0

type FieldError struct {
	Field     string
	Message   string
	Validator validator.FieldError
}

FieldError contains field name and validator error

func (FieldError) Error added in v0.4.0

func (f FieldError) Error() string

type FieldLevel added in v0.4.0

type FieldLevel = validator.FieldLevel

type Func added in v0.4.0

type Func = validator.Func

type Options

type Options struct {
	Struct    interface{}
	Errors    error
	Formatter func(fields []*FieldError) string
}

Options to call CheckErrors method

type Validator

type Validator interface {
	Validate(i interface{}) error
	Register(tag string, fn Func) error
}

func New

func New() Validator

Jump to

Keyboard shortcuts

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