validations

package
v0.5.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNilStructValidations = errors.New("struct validations is nil")
	ErrNilFieldValidations  = errors.New("field validations is nil")
)

Functions

This section is empty.

Types

type FieldValidations added in v0.5.0

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

FieldValidations is a struct that holds the field validations for the generated validations of a struct

func NewFieldValidations added in v0.5.0

func NewFieldValidations() *FieldValidations

NewFieldValidations creates a new FieldValidations struct

func (*FieldValidations) AddValidationError added in v0.5.0

func (f *FieldValidations) AddValidationError(
	validationError error,
)

AddValidationError adds a validation error to the field

func (*FieldValidations) GetErrors added in v0.5.0

func (f *FieldValidations) GetErrors() *[]error

GetErrors returns the field errors

func (*FieldValidations) HasFailed added in v0.5.0

func (f *FieldValidations) HasFailed() bool

HasFailed returns true if there are failed validations

type StructValidations added in v0.5.0

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

StructValidations is a struct that holds the struct validations for the generated validations of a struct

func NewStructValidations added in v0.5.0

func NewStructValidations() *StructValidations

NewStructValidations creates a new StructValidations struct

func (*StructValidations) AddFieldValidationError added in v0.5.0

func (s *StructValidations) AddFieldValidationError(
	fieldName string,
	validationError error,
)

AddFieldValidationError adds a validation error to the field

func (*StructValidations) AddFieldValidations added in v0.5.0

func (s *StructValidations) AddFieldValidations(
	fieldName string,
	fieldValidations *FieldValidations,
)

AddFieldValidations sets the fields validations to the struct

func (*StructValidations) AddNestedStructValidations added in v0.5.0

func (s *StructValidations) AddNestedStructValidations(
	fieldName string,
	nestedStructValidations *StructValidations,
)

AddNestedStructValidations sets the nested struct fields validations to the struct

func (*StructValidations) GetFieldsValidations added in v0.5.0

func (s *StructValidations) GetFieldsValidations() *map[string]*FieldValidations

GetFieldsValidations returns the fields validations

func (*StructValidations) GetNestedStructsValidations added in v0.5.0

func (s *StructValidations) GetNestedStructsValidations() *map[string]*StructValidations

GetNestedStructsValidations returns the nested structs validations

func (*StructValidations) HasFailed added in v0.5.0

func (s *StructValidations) HasFailed() bool

HasFailed returns true if there are failed validations

Jump to

Keyboard shortcuts

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