validate

package
v0.0.0-...-537d0aa Latest Latest
Warning

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

Go to latest
Published: Oct 26, 2024 License: GPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ValueEvaluator

type ValueEvaluator struct {
	// contains filtered or unexported fields
}

ValueEvaluator is a struct for evaluating input values

func Validate

func Validate(value interface{}) *ValueEvaluator

Validate creates a new ValueEvaluator instance with options.

func (*ValueEvaluator) CustomErrorMessage

func (ve *ValueEvaluator) CustomErrorMessage(customError []string, defaultMessage string) []string

CustomErrorMessage returns a formatted custom error message or an empty array if not provided.

func (*ValueEvaluator) GetResult

func (ve *ValueEvaluator) GetResult() []string

GetResult returns the evaluation result.

func (*ValueEvaluator) HasMapExactKeys

func (ve *ValueEvaluator) HasMapExactKeys(expectedKeys []string, customError ...string) *ValueEvaluator

///////////////////////////////////////////////////////////////////////////// ///////////////////////////// HasMapExactKeys ///////////////////////////////

HasMapExactKeys checks if a map has the exact number and name of keys in first hierarchy layer

func (*ValueEvaluator) IsEmail

func (ve *ValueEvaluator) IsEmail(customError ...string) *ValueEvaluator

///////////////////////////////////////////////////////////////////////////// ///////////////////////////// IsEmail ///////////////////////////////////////

IsEmail checks if the value, when converted to a string, is in email format.

func (*ValueEvaluator) IsPasswordValid

func (ve *ValueEvaluator) IsPasswordValid(customError ...string) *ValueEvaluator

///////////////////////////////////////////////////////////////////////////// /////////////////////////// IsPasswordValid /////////////////////////////////

Check valid password format

func (*ValueEvaluator) IsValid

func (ve *ValueEvaluator) IsValid() bool

func (*ValueEvaluator) IsValidIPList

func (ve *ValueEvaluator) IsValidIPList(customError ...string) *ValueEvaluator

///////////////////////////////////////////////////////////////////////////// /////////////////////////// IsValidIPList ///////////////////////////////////

IsValidIPList checks if the slice of strings contains valid IPv6 or IPv4 addresses.

func (*ValueEvaluator) MaxIntValue

func (ve *ValueEvaluator) MaxIntValue(maxValue int, customError ...string) *ValueEvaluator

///////////////////////////////////////////////////////////////////////////// ///////////////////////////// MaxIntValue ///////////////////////////////////

MaxIntValue checks if the value is an integer and does not exceed a maximum value

func (*ValueEvaluator) MaxLength

func (ve *ValueEvaluator) MaxLength(maxLength int, customError ...string) *ValueEvaluator

///////////////////////////////////////////////////////////////////////////// ///////////////////////////// MaxLength /////////////////////////////////////

MaxLength checks if the string representation of the value exceeds a maximum length.

func (*ValueEvaluator) MaxStringArrayLength

func (ve *ValueEvaluator) MaxStringArrayLength(maxLength int, customError ...string) *ValueEvaluator

///////////////////////////////////////////////////////////////////////////// ////////////////////// MaxStringArrayLength /////////////////////////////////

Validate length of array of strings

func (*ValueEvaluator) MinLength

func (ve *ValueEvaluator) MinLength(minLength int, customError ...string) *ValueEvaluator

///////////////////////////////////////////////////////////////////////////// ///////////////////////////// MinLength /////////////////////////////////////

MinLength checks if the string representation of the value exceeds a minimum length.

Jump to

Keyboard shortcuts

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