validator

package
v0.16.2 Latest Latest
Warning

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

Go to latest
Published: Dec 31, 2025 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterNullValueTypeFunc

func RegisterNullValueTypeFunc[T any]()

func RegisterTypeFunc

func RegisterTypeFunc(fn CustomTypeFunc, types ...any)

func RegisterValidationRules

func RegisterValidationRules(rules ...ValidationRule) error

func Validate

func Validate(value any) error

Types

type CustomTypeFunc

type CustomTypeFunc = func(field reflect.Value) any

type ValidationRule

type ValidationRule struct {
	RuleTag                  string
	ErrMessageTemplate       string
	ErrMessageI18nKey        string
	Validate                 func(fl v.FieldLevel) bool
	ParseParam               func(fe v.FieldError) []string
	CallValidationEvenIfNull bool
}

Jump to

Keyboard shortcuts

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