Documentation ¶
Index ¶
- Variables
- type FieldValidations
- type StructValidations
- func (s *StructValidations) AddFieldValidationError(fieldName string, validationError error)
- func (s *StructValidations) AddFieldValidations(fieldName string, fieldValidations *FieldValidations)
- func (s *StructValidations) AddNestedStructValidations(fieldName string, nestedStructValidations *StructValidations)
- func (s *StructValidations) GetFieldsValidations() *map[string]*FieldValidations
- func (s *StructValidations) GetNestedStructsValidations() *map[string]*StructValidations
- func (s *StructValidations) HasFailed() bool
Constants ¶
This section is empty.
Variables ¶
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