validation

package
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Apr 19, 2021 License: MIT Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterValidator

func RegisterValidator(name string, validator func() validator.Validator)

This allows you to register custom validator to be read from struct field tag validatoin data.

Types

type ValidationError

type ValidationError struct {
	DataType string
	Errors   validationErrorMap
}

func Validate

Thinking of building validation code to read tags. The Validator parameter is present to allow for validating non struct values. In this function A *Validator can be passed in and evaluated on a non struct value like an individual int or string TODO: Validate nested structs and arrays.

func ValidateStructWithTag

func ValidateStructWithTag(s interface{}) *ValidationError

This function valudates an input struct based on the validation tags is has in its tag data.

func (*ValidationError) Error

func (e *ValidationError) Error() string

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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