validation

package
v0.25.2 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2023 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Validator

type Validator interface {
	// Register custom modifier.
	RegisterModifier(name string, fn func(in string, param ...string) (out string)) error
	// Modify struct field value according to modifier tag.
	// Param `data` should be a pointer.
	Modify(data interface{}) error

	// Register custom validator.
	RegisterValidator(name string, fn func(value interface{}, param ...string) (ok bool)) error
	// Register error message handler.
	RegisterValidatorError(name string, fn func(field string, param ...string) (msg error)) error
	// Validate struct field value according to validator tag.
	// Param `data` should be a pointer.
	Validate(data interface{}) error
}

Validator is validating interface.

See usage example in example folder.

Directories

Path Synopsis
Package playground is a wrapper of the original "github.com/go-playground/validator" and "github.com/go-playground/mold" library.
Package playground is a wrapper of the original "github.com/go-playground/validator" and "github.com/go-playground/mold" library.

Jump to

Keyboard shortcuts

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