validation

package
v0.0.0-...-4877560 Latest Latest
Warning

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

Go to latest
Published: May 12, 2021 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetFieldJSONTag

func GetFieldJSONTag(u interface{}, fldName string) (string, bool)

GetFieldJSONTag returns field's `json` tag name

func New

func New() *validator.Validate

New returns new *validator.Validate

Types

type StructValidError

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

StructValidError represents an error for the struct validation use `ValidationErrors` to get the map of fields with error text

func NewStructValidError

func NewStructValidError(errsMap map[string]string, errTxt ...string) *StructValidError

NewStructValidError creates new structValidError with given map of errors and optional error text

func (StructValidError) Error

func (err StructValidError) Error() string

func (*StructValidError) Format

func (err *StructValidError) Format() map[string]interface{}

Format returns map of errors for use as a response

func (*StructValidError) ValidationErrors

func (err *StructValidError) ValidationErrors() map[string]string

ValidationErrors returns map of fields errors

Jump to

Keyboard shortcuts

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