validators

package
v0.9.2 Latest Latest
Warning

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

Go to latest
Published: Feb 28, 2025 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrorMessage_Default = "field value is invalid"

	ErrorMessage_Required        = "value is required"
	ErrorMessage_UUID            = "value must be a valid UUID"
	ErrorMessage_Equals          = "value must be equal to '%s'"
	ErrorMessage_Laptime         = "value must be a valid laptime 'MM:SS:mmm'"
	ErrorMessage_HTTP_URL        = "value must a valid http url"
	ErrorMessage_GreaterThan     = "value must be greater than '%s'"
	ErrorMessage_RequiredWithout = "value or '%s' is required"
)

Functions

func RegisterCustomValidation

func RegisterCustomValidation(name string, vldFunc func(reflect.Value) bool)

func ValidateStruct

func ValidateStruct(s interface{}) error

Types

type ValidationError

type ValidationError struct {
	Field string      `json:"field"`
	Param string      `json:"param,omitempty"`
	Value interface{} `json:"value"`
	Err   string      `json:"error"`
}

type ValidationErrors

type ValidationErrors []ValidationError

func (ValidationErrors) Error

func (ve ValidationErrors) Error() string

Jump to

Keyboard shortcuts

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