validation

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error struct {
	Key     string `json:"key"`
	Type    string `json:"type"`
	Message string `json:"message"`
}

Error defines the structure when returning validation errors.

type Errors

type Errors []Error

type Validation

type Validation struct {
	Package *pkgValidate.Validate
}

Validation defines site wide validation for endpoints and using the Package validation helper.

func New

func New() *Validation

New - Construct & set tag name

func (*Validation) CmdCheck

func (v *Validation) CmdCheck(key string, data interface{}) error

CmdCheck is a function for checking validation by struct on the command line.

func (*Validation) Process

func (v *Validation) Process(errors pkgValidate.ValidationErrors) []Error

Process handles validation errors and passes back to respond.

type Validator

type Validator interface {
	Process(errors pkgValidate.ValidationErrors) []Error
	CmdCheck(key string, data interface{}) error
	// contains filtered or unexported methods
}

Validator defines methods for checking the validation errors

Jump to

Keyboard shortcuts

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