validator

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 12, 2024 License: MIT Imports: 9 Imported by: 2

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetValidatedBody

func GetValidatedBody(req *http.Request, validatorMap VMap) (map[string]interface{}, error)

func ValidateBody

func ValidateBody(body map[string]interface{}, validatorMap VMap) (map[string]interface{}, error)

func ValidateMap

func ValidateMap(dictionary map[string]interface{}, validatorMap VMap) []gohttplib.Error

func ValidateValue

func ValidateValue(value interface{}, validators []Validator) []gohttplib.Error

Types

type FloatRange

type FloatRange struct {
	Upper  *float64
	Bottom *float64
}

type Int64Range

type Int64Range struct {
	Upper  *int64
	Bottom *int64
}

type IntRange

type IntRange struct {
	Upper  *int
	Bottom *int
}

type VMap

type VMap map[string][]Validator

type Validator

type Validator func(value interface{}) error

func ArrayValidator

func ArrayValidator(key string) Validator

func BoolValidator

func BoolValidator(key string) Validator

func CountryValidator

func CountryValidator(key string) Validator

func DateTimeValidator

func DateTimeValidator(key string, t *time.Time) Validator

func DistanceValidator added in v0.0.2

func DistanceValidator(key string) Validator

func FloatInRangeValidator

func FloatInRangeValidator(key string, floatRange FloatRange) Validator

func FloatValidator

func FloatValidator(key string) Validator

func Int64InRangeValidator

func Int64InRangeValidator(key string, intRange Int64Range) Validator

func IntInRangeValidator

func IntInRangeValidator(key string, intRange IntRange) Validator

func IntValidator

func IntValidator(key string) Validator

func LanguageValidator

func LanguageValidator(key string) Validator

func LatitudeValidators added in v0.0.2

func LatitudeValidators(key string) []Validator

func LongitudeValidators added in v0.0.2

func LongitudeValidators(key string) []Validator

func NotEmptyValidator

func NotEmptyValidator(key string) Validator

func RequiredBoolValidators

func RequiredBoolValidators(key string, validators ...Validator) []Validator

func RequiredFloatValidators

func RequiredFloatValidators(key string, validators ...Validator) []Validator

func RequiredIntValidators

func RequiredIntValidators(key string, validators ...Validator) []Validator

func RequiredStringValidators

func RequiredStringValidators(key string, validators ...Validator) []Validator

func SexValidator

func SexValidator(key string) Validator

func StringArrayValidator

func StringArrayValidator(key string, each []Validator) Validator

func StringContainsValidator

func StringContainsValidator(key string, values []string) Validator

func StringLengthValidator

func StringLengthValidator(length int, key string) Validator

func StringValidator

func StringValidator(key string) Validator

func TimezoneValidator

func TimezoneValidator(key string) Validator

func URLValidator

func URLValidator(key string) Validator

Jump to

Keyboard shortcuts

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