validator

package
v0.0.0-...-0b524ee Latest Latest
Warning

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

Go to latest
Published: Apr 28, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterDefaultValidationRules

func RegisterDefaultValidationRules()

RegisterDefaultValidationRules registers the default validation rules provided by the package.

func RegisterValidationRule

func RegisterValidationRule(name string, validateFunc ValidationRule)

RegisterValidationRule registers a custom validation rule with a given name and validation function.

func ValidateStruct

func ValidateStruct(input interface{}, lang string) error

ValidateStruct validates a struct based on the specified validation tags and language. It returns an error if validation fails or if any required input is missing.

Types

type ValidationRule

type ValidationRule func(reflect.Value, locales.ErrorMessages, string, string) error

ValidationRule represents a function type for custom validation rules. It takes the field value to be validated, error messages, field name, and tag as input, and returns an error if validation fails.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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