Documentation ¶
Index ¶
- Variables
- type DefaultValidator
- func (d *DefaultValidator) CheckValidations(validations *govalidatorvalidations.Validations) error
- func (d *DefaultValidator) ModeFlag() *goflagmode.Flag
- func (d *DefaultValidator) ValidateBirthdate(birthdateField string, birthdate *timestamppb.Timestamp, ...)
- func (d *DefaultValidator) ValidateEmail(emailField string, email string, ...)
- func (d *DefaultValidator) ValidateNilFields(request interface{}, mapper *govalidatormapper.Mapper) (*govalidatorvalidations.Validations, error)
- type Service
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ValidationsError = "validations error: %v" FailedToGenerateMessageError = errors.New("failed to generate message") NilValidatorError = errors.New("validator cannot be nil") NilMessageError = errors.New("message cannot be nil") NilValidationsError = errors.New("validations cannot be nil") )
Functions ¶
This section is empty.
Types ¶
type DefaultValidator ¶
type DefaultValidator struct {
// contains filtered or unexported fields
}
DefaultValidator struct
func NewDefaultValidator ¶
func NewDefaultValidator( generator *govalidatorvalidations.Generator, validator *govalidatorvalidations.Validator, mode *goflagmode.Flag, ) (*DefaultValidator, error)
NewDefaultValidator creates a new default validator
func (*DefaultValidator) CheckValidations ¶
func (d *DefaultValidator) CheckValidations( validations *govalidatorvalidations.Validations, ) error
CheckValidations checks the validations and returns a pointer to the error message
func (*DefaultValidator) ModeFlag ¶
func (d *DefaultValidator) ModeFlag() *goflagmode.Flag
ModeFlag returns the mode flag
func (*DefaultValidator) ValidateBirthdate ¶
func (d *DefaultValidator) ValidateBirthdate( birthdateField string, birthdate *timestamppb.Timestamp, validations *govalidatorvalidations.Validations, )
ValidateBirthdate validates the birthdate field
func (*DefaultValidator) ValidateEmail ¶
func (d *DefaultValidator) ValidateEmail( emailField string, email string, validations *govalidatorvalidations.Validations, )
ValidateEmail validates the email address field
func (*DefaultValidator) ValidateNilFields ¶
func (d *DefaultValidator) ValidateNilFields( request interface{}, mapper *govalidatormapper.Mapper, ) (*govalidatorvalidations.Validations, error)
ValidateNilFields validates the nil fields
type Service ¶
type Service interface { ModeFlag() *goflagmode.Flag ValidateEmail( emailField string, email string, validations *govalidatorvalidations.Validations, ) ValidateBirthdate( birthdateField string, birthdate *timestamppb.Timestamp, validations *govalidatorvalidations.Validations, ) ValidateNilFields( request interface{}, mapper *govalidatormapper.Mapper, ) ( *govalidatorvalidations.Validations, error, ) CheckValidations(validations *govalidatorvalidations.Validations) error }
Service interface for the validator service
Click to show internal directories.
Click to hide internal directories.