validation

package
v0.0.0-...-ec844c3 Latest Latest
Warning

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

Go to latest
Published: Feb 25, 2026 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ErrorDuration    = "invalid iso duration provided %v"
	ErrorDurationMin = "must be >= %s"
	ErrorDurationMax = "must be <= %s"
)
View Source
const (
	ErrorPassword        = "failed to meet password requirements:\n%v"
	ErrorPasswordLength  = "must have at least %d characters"
	ErrorPasswordLower   = "must have at least %d lowercase characters"
	ErrorPasswordUpper   = "must have at least %d uppercase characters"
	ErrorPasswordSpecial = "must have at least %d special characters"
	ErrorPasswordNumeric = "must have at least %d numeric characters"
)
View Source
const (
	ErrorUrlHttpsInvalid = "invalid https url format"
	ErrorUrlInvalid      = "invalid url format"
)
View Source
const (
	ErrorValidation   = "validation failed:\n%8s"
	ErrorUnmatchedTag = "no validator registered that matches tag: %s"
)
View Source
const (
	ErrInvalidRrule = "invalid rrule specified: %s"
)

Variables

This section is empty.

Functions

func NewRequiredError

func NewRequiredError(value any) error

func NewRequiredIfAuthTypeError

func NewRequiredIfAuthTypeError(value any) error

func ValidUrl

func ValidUrl(inputUrl string) error

func Validate

func Validate(obj any) utils.Errors

Types

type DurationValidator

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

func (DurationValidator) Validate

func (s DurationValidator) Validate(value any) utils.Errors

type PasswordValidator

type PasswordValidator struct {
	Length, Lower, Upper, Special, Numeric int
}

func (PasswordValidator) Validate

func (s PasswordValidator) Validate(value any) utils.Errors

type RRuleValidator

type RRuleValidator struct {
}

type RRuleValidator struct implements the Validator interface which allows the usage of the `rrule` struct tag to ensure a string is in a valid rrule format by calling `Validate`

func (RRuleValidator) Validate

func (s RRuleValidator) Validate(value any) utils.Errors

type RequiredIfAuthTypeValidator

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

func (RequiredIfAuthTypeValidator) Validate

func (s RequiredIfAuthTypeValidator) Validate(value any) utils.Errors

type RequiredValidator

type RequiredValidator struct{}

func (RequiredValidator) Validate

func (s RequiredValidator) Validate(value any) utils.Errors

type UrlValidator

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

UrlValidator implements the Validator interface which allows the usage of the `url` struct tag to ensure a string is in a valid url format by calling `Validate`

func (UrlValidator) Validate

func (s UrlValidator) Validate(value any) utils.Errors

Validate validates that the associated struct fields are in the proper formatting

type Validator

type Validator interface {
	Validate(value any) utils.Errors
}

func NewDurationValidator

func NewDurationValidator(params map[string]string) Validator

func NewPasswordValidator

func NewPasswordValidator(params map[string]string) Validator

func NewRRuleValidator

func NewRRuleValidator(_ map[string]string) Validator

NewRRuleValidator returns a new Validator

func NewRequiredIfAuthTypeValidator

func NewRequiredIfAuthTypeValidator(params map[string]string) Validator

func NewRequiredValidator

func NewRequiredValidator(_ map[string]string) Validator

func NewUrlValidator

func NewUrlValidator(params map[string]string) Validator

NewUrlValidator returns a new Validator

type ValidatorFactory

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

func (ValidatorFactory) NewValidatorFromTag

func (s ValidatorFactory) NewValidatorFromTag(tag string) Validator

type ValidatorFactoryFunc

type ValidatorFactoryFunc func(options map[string]string) Validator

Directories

Path Synopsis
Package mocks is a generated GoMock package.
Package mocks is a generated GoMock package.

Jump to

Keyboard shortcuts

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