Documentation
¶
Overview ¶
Package veritas provides Brazilian CNPJ validation functions.
Package veritas provides Brazilian CPF validation functions.
Package veritas provides email validation functions.
Package veritas provides numeric validation functions.
Package veritas provides phone number validation functions.
Package veritas provides string validation functions.
Package veritas provides URL validation functions.
Package veritas provides a comprehensive collection of input validation functions for various data formats including strings, numbers, Brazilian documents, and more.
Index ¶
- type Validator
- func (v *Validator) Between(num interface{}, min, max float64) error
- func (v *Validator) BiggerThan(num interface{}, than float64) error
- func (v *Validator) CNPJ(cnpj interface{}) error
- func (v *Validator) CPF(cpf interface{}) error
- func (v *Validator) CleanString(s string, toLower bool) string
- func (v *Validator) CompileRegex(pattern string) (*regexp.Regexp, error)
- func (v *Validator) Email(email interface{}) error
- func (v *Validator) HasErrors(errors []*ValidationError) bool
- func (v *Validator) IsEmpty(s string) bool
- func (v *Validator) IsEven(num interface{}) error
- func (v *Validator) IsNegative(num interface{}) error
- func (v *Validator) IsNotEmpty(s string) bool
- func (v *Validator) IsNumber(num interface{}) error
- func (v *Validator) IsPositive(num interface{}) error
- func (v *Validator) IsPrime(num interface{}) error
- func (v *Validator) MatchRegex(s, pattern string) (bool, error)
- func (v *Validator) Phone(phone interface{}) error
- func (v *Validator) SmallerThan(num interface{}, than float64) error
- func (v *Validator) String(str interface{}, minLength, maxLength int) error
- func (v *Validator) URL(urlStr interface{}) error
- func (v *Validator) Validate(field string, value interface{}, validator func(interface{}) error) *ValidationError
- func (v *Validator) ValidateMultiple(validations ...func() *ValidationError) []*ValidationError
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Validator ¶
type Validator struct {
}
Validator represents the main validation struct that provides access to all validation methods.
func (*Validator) BiggerThan ¶
BiggerThan validates that a number is bigger than the given value.
func (*Validator) CleanString ¶
CleanString removes leading/trailing whitespace and converts to lowercase if specified.
func (*Validator) CompileRegex ¶
CompileRegex compiles a regular expression pattern and returns an error if invalid.
func (*Validator) IsNegative ¶
IsNegative validates that a number is negative (< 0).
func (*Validator) IsNotEmpty ¶
IsNotEmpty checks if a string is not empty and contains non-whitespace characters.
func (*Validator) IsPositive ¶
IsPositive validates that a number is positive (> 0).
func (*Validator) MatchRegex ¶
MatchRegex checks if a string matches the given regular expression pattern.
func (*Validator) SmallerThan ¶
SmallerThan validates that a number is smaller than the given value.
func (*Validator) Validate ¶
func (v *Validator) Validate(field string, value interface{}, validator func(interface{}) error) *ValidationError
Validate performs validation on a value using the provided validation function. It returns a ValidationError if validation fails, nil otherwise.
func (*Validator) ValidateMultiple ¶
func (v *Validator) ValidateMultiple(validations ...func() *ValidationError) []*ValidationError
ValidateMultiple performs multiple validations and returns all validation errors.