service

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	NilValidatorError = errors.New("validator cannot be nil")
	NilMessageError   = errors.New("message 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(mode *goflagmode.Flag) *DefaultValidator

NewDefaultValidator creates a new default validator

func (*DefaultValidator) CheckValidations

func (d *DefaultValidator) CheckValidations(
	mapperValidations *govalidatorvalidations.MapperValidations,
) *string

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,
	mapperValidations *govalidatorvalidations.MapperValidations,
)

ValidateBirthdate validates the birthdate field

func (*DefaultValidator) ValidateEmail

func (d *DefaultValidator) ValidateEmail(
	emailField string,
	email string,
	mapperValidations *govalidatorvalidations.MapperValidations,
)

ValidateEmail validates the email address field

func (*DefaultValidator) ValidateNilFields

func (d *DefaultValidator) ValidateNilFields(
	request interface{},
	mapper *govalidatormapper.Mapper,
) (*govalidatorvalidations.MapperValidations, error)

ValidateNilFields validates the nil fields

type Validator

type Validator interface {
	ModeFlag() *goflagmode.Flag
	ValidateEmail(
		emailField string,
		email string,
		mapperValidations *govalidatorvalidations.MapperValidations,
	)
	ValidateBirthdate(
		birthdateField string,
		birthdate *timestamppb.Timestamp,
		mapperValidations *govalidatorvalidations.MapperValidations,
	)
	ValidateNilFields(request interface{}, mapper *govalidatormapper.Mapper) (
		*govalidatorvalidations.MapperValidations,
		error,
	)
	CheckValidations(mapperValidations *govalidatorvalidations.MapperValidations) *string
}

Validator interface

Jump to

Keyboard shortcuts

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