validation

package
v0.0.3 Latest Latest
Warning

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

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

Documentation

Overview

The validation package handles validating data with validators from the validator package. For more info on validators or the tag syntax for validating struct fields please see the documentation for the validator package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterValidator

func RegisterValidator(name string, customValidatorFactory validator.ValidatorFactory)

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
}

ValidationError represents the overall validation state of a value.

func Validate

The Validator parameter is present to allow for validating non struct values. In this function A Validator pointer can be passed in and evaluated on a non struct value like an individual int or string.

func ValidateStructWithTag

func ValidateStructWithTag(s interface{}) *ValidationError

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

func (*ValidationError) Error

func (e *ValidationError) Error() string

Error produces a string that relays all of the validation failures from validation.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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