validator

package
v0.306.0 Latest Latest
Warning

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

Go to latest
Published: Mar 22, 2023 License: Apache-2.0 Imports: 4 Imported by: 6

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	DefaultValidator *vv10.Validate
)

Functions

func NewDefaultValidator

func NewDefaultValidator() *vv10.Validate

func RegisterCustomValidator

func RegisterCustomValidator(fn vv10.CustomTypeFunc, types ...interface{})

func RegisterStructLevel

func RegisterStructLevel(fn vv10.StructLevelFunc, types ...interface{})

func Validate

func Validate(v interface{}) error

Validate validates the fields of a struct based on 'validator' tags and returns errors found indexed by the field name.

func ValidateString added in v0.258.0

func ValidateString(val, tag string) error

Var validates a single string using tag style validation.

Types

type Validator

type Validator interface {
	Validate() error
}

Validator values have a Validate() method returning nil iff the value is deemed valid.

Jump to

Keyboard shortcuts

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