validation

package
v0.0.0-...-6ebe9bd Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binder

type Binder struct{}

Binder is used to create custom binder instance.

func (*Binder) Bind

func (b *Binder) Bind(i interface{}, c echo.Context) (err error)

Bind tries to bind data and if it doesn't succeed returns error.

type Error

type Error struct {
	Errors []string `json:"validation_errors"`
}

Error represents validation error.

func (*Error) Error

func (e *Error) Error() string

type Validator

type Validator struct {
	// contains filtered or unexported fields
}

Validator represents custom validator that validates structs based on tags.

func NewValidator

func NewValidator() (*Validator, error)

NewValidator returns instance of validator.

func (*Validator) Validate

func (v *Validator) Validate(i interface{}) error

Validate validates the struct and returns translated errors.

Jump to

Keyboard shortcuts

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