Documentation
¶
Index ¶
- Constants
- type Alpha
- type Alphanumeric
- type Email
- type MaxLength
- type MinLength
- type NotBlank
- type Numeric
- type Regex
- type ValidationError
- func (instance *ValidationError) Code() string
- func (instance *ValidationError) Context() map[string]any
- func (instance *ValidationError) Error() string
- func (instance *ValidationError) Field() string
- func (instance *ValidationError) MarshalJSON() ([]byte, error)
- func (instance *ValidationError) Message() string
- func (instance *ValidationError) ToExceptionError() error
- type ValidationErrors
- type Validator
Constants ¶
View Source
const ( ServiceValidator = "service.validator" ConstraintNotBlank = "notBlank" ConstraintEmail = "email" ConstraintMin = "min" ConstraintMax = "max" ConstraintRegex = "regex" ConstraintNumeric = "numeric" ConstraintAlpha = "alpha" ConstraintAlphanumeric = "alphanumeric" ErrorInvalidRuleSyntax = "invalidRuleSyntax" ErrorUnknownRule = "unknownRule" ErrorNotBlank = "notBlank" ErrorInvalidEmail = "invalidEmail" ErrorMinLength = "minLength" ErrorMaxLength = "maxLength" ErrorInvalidPattern = "invalidPattern" ErrorRegexMismatch = "regexMismatch" ErrorNotNumeric = "notNumeric" ErrorNotAlpha = "notAlpha" ErrorNotAlphanumeric = "notAlphanumeric" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alpha ¶
type Alpha struct{}
func (*Alpha) Validate ¶
func (instance *Alpha) Validate(value any, field string) validationcontract.ValidationError
type Alphanumeric ¶
type Alphanumeric struct{}
func (*Alphanumeric) Validate ¶
func (instance *Alphanumeric) Validate(value any, field string) validationcontract.ValidationError
type Email ¶
type Email struct{}
func (*Email) Validate ¶
func (instance *Email) Validate(value any, field string) validationcontract.ValidationError
type MaxLength ¶
type MaxLength struct {
// contains filtered or unexported fields
}
func NewMaxLength ¶
func (*MaxLength) Validate ¶
func (instance *MaxLength) Validate(value any, field string) validationcontract.ValidationError
type MinLength ¶
type MinLength struct {
// contains filtered or unexported fields
}
func NewMinLength ¶
func (*MinLength) Validate ¶
func (instance *MinLength) Validate(value any, field string) validationcontract.ValidationError
type NotBlank ¶
type NotBlank struct{}
func (*NotBlank) Validate ¶
func (instance *NotBlank) Validate(value any, field string) validationcontract.ValidationError
type Numeric ¶
type Numeric struct{}
func (*Numeric) Validate ¶
func (instance *Numeric) Validate(value any, field string) validationcontract.ValidationError
type Regex ¶
type Regex struct {
// contains filtered or unexported fields
}
func (*Regex) Validate ¶
func (instance *Regex) Validate(value any, field string) validationcontract.ValidationError
type ValidationError ¶
type ValidationError struct {
// contains filtered or unexported fields
}
func NewValidationError ¶
func (*ValidationError) Code ¶
func (instance *ValidationError) Code() string
func (*ValidationError) Context ¶
func (instance *ValidationError) Context() map[string]any
func (*ValidationError) Error ¶
func (instance *ValidationError) Error() string
func (*ValidationError) Field ¶
func (instance *ValidationError) Field() string
func (*ValidationError) MarshalJSON ¶
func (instance *ValidationError) MarshalJSON() ([]byte, error)
func (*ValidationError) Message ¶
func (instance *ValidationError) Message() string
func (*ValidationError) ToExceptionError ¶
func (instance *ValidationError) ToExceptionError() error
type ValidationErrors ¶
type ValidationErrors []validationcontract.ValidationError
func (ValidationErrors) Error ¶
func (instance ValidationErrors) Error() string
func (ValidationErrors) HasErrors ¶
func (instance ValidationErrors) HasErrors() bool
type Validator ¶
type Validator struct {
// contains filtered or unexported fields
}
func NewValidator ¶
func NewValidator() *Validator
func ValidatorFromContainer ¶
func ValidatorFromContainer(serviceContainer containercontract.Container) *Validator
func ValidatorMustFromContainer ¶
func ValidatorMustFromContainer(serviceContainer containercontract.Container) *Validator
func (*Validator) RegisterConstraint ¶
func (instance *Validator) RegisterConstraint(name string, constraint validationcontract.Constraint)
Source Files
¶
Click to show internal directories.
Click to hide internal directories.