validator

package
v0.0.0-...-0871eb3 Latest Latest
Warning

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

Go to latest
Published: Feb 4, 2021 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var TagMap = map[string]BasicValidator{
	"nonempty": isNonEmpty,
	"email":    isEmail,
	"url":      isURL,
	"number":   isNumber,
	"alphabet": isAlphabet,
}

TagMap is to map tag name of struct to function

View Source
var TagMapCal = map[string]CalcValidator{
	"min": isMinOK,
	"max": isMaxOK,
}

TagMapCal is to map tag name of struct to function

Functions

func CheckValidation

func CheckValidation(s interface{}, brankSkip bool) map[string][]string

CheckValidation to check validation after extracted tag from struct type.

func ConvertErrorMsgs

func ConvertErrorMsgs(data map[string][]string, errFmt map[string]string) []string

ConvertErrorMsgs is to convert error messages

Types

type BasicValidator

type BasicValidator func(str string) bool

BasicValidator is validator function

type CalcValidator

type CalcValidator func(str string, num int) bool

CalcValidator is validator function

Jump to

Keyboard shortcuts

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