validator

package
v0.5.2 Latest Latest
Warning

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

Go to latest
Published: Jan 6, 2025 License: GPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilData       = errors.New("data cannot be nil")
	ErrNilMapper     = errors.New("mapper cannot be nil")
	ErrNilValidator  = errors.New("mapper validator cannot be nil")
	ErrRequiredField = "%s is required"
)

Functions

This section is empty.

Types

type DefaultValidator

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

DefaultValidator struct

func NewDefaultValidator

func NewDefaultValidator(
	logger *Logger,
) *DefaultValidator

NewDefaultValidator creates a new default mapper validator

func (*DefaultValidator) ValidateRequiredFields added in v0.5.0

func (d *DefaultValidator) ValidateRequiredFields(
	rootStructValidations *govalidatormappervalidations.StructValidations,
	data interface{},
	mapper *govalidatormapper.Mapper,
) (err error)

ValidateRequiredFields validates the required fields of a struct

type Logger added in v0.4.6

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

Logger is the JWT validator logger

func NewLogger added in v0.4.6

func NewLogger(header string, modeLogger gologgermode.Logger) (*Logger, error)

NewLogger creates a new JWT validator logger

func (*Logger) PrintField added in v0.4.6

func (l *Logger) PrintField(
	fieldName string,
	fieldType reflect.Type,
	fieldValue interface{},
)

PrintField prints the field on debug mode

func (*Logger) UninitializedField added in v0.4.6

func (l *Logger) UninitializedField(fieldName string)

UninitializedField prints the uninitialized field on debug mode

type Validator

type Validator interface {
	ValidateRequiredFields(
		rootStructValidations *govalidatormappervalidations.StructValidations,
		data interface{},
		mapper *govalidatormapper.Mapper,
	) (err error)
}

Validator interface

Jump to

Keyboard shortcuts

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