Documentation ¶
Index ¶
- Variables
- type DefaultValidations
- func (d *DefaultValidations) AddFailedFieldValidationError(fieldName string, validationError error)
- func (d *DefaultValidations) GetFailedFieldsValidations() *map[string][]error
- func (d *DefaultValidations) GetNestedFieldsValidations() *map[string]Validations
- func (d *DefaultValidations) HasFailed() bool
- func (d *DefaultValidations) SetNestedFieldsValidations(fieldName string, nestedValidations Validations)
- type Validations
Constants ¶
This section is empty.
Variables ¶
Functions ¶
This section is empty.
Types ¶
type DefaultValidations ¶
type DefaultValidations struct { FailedFieldsValidations *map[string][]error NestedFieldsValidations *map[string]Validations }
DefaultValidations is a struct that holds the error messages for failed validations of a struct
func NewDefaultValidations ¶
func NewDefaultValidations() *DefaultValidations
NewDefaultValidations creates a new DefaultValidations struct
func (*DefaultValidations) AddFailedFieldValidationError ¶
func (d *DefaultValidations) AddFailedFieldValidationError( fieldName string, validationError error, )
AddFailedFieldValidationError adds a failed field validation error to the struct
func (*DefaultValidations) GetFailedFieldsValidations ¶ added in v0.4.0
func (d *DefaultValidations) GetFailedFieldsValidations() *map[string][]error
GetFailedFieldsValidations returns the failed fields validations
func (*DefaultValidations) GetNestedFieldsValidations ¶ added in v0.4.0
func (d *DefaultValidations) GetNestedFieldsValidations() *map[string]Validations
GetNestedFieldsValidations returns the nested struct fields validations
func (*DefaultValidations) HasFailed ¶
func (d *DefaultValidations) HasFailed() bool
HasFailed returns true if there are failed validations
func (*DefaultValidations) SetNestedFieldsValidations ¶ added in v0.4.0
func (d *DefaultValidations) SetNestedFieldsValidations( fieldName string, nestedValidations Validations, )
SetNestedFieldsValidations sets the nested struct fields validations to the struct
type Validations ¶
type Validations interface { HasFailed() bool AddFailedFieldValidationError( fieldName string, validationError error, ) SetNestedFieldsValidations( fieldName string, nestedValidations Validations, ) GetFailedFieldsValidations() *map[string][]error GetNestedFieldsValidations() *map[string]Validations }
Validations interface is an interface for struct fields validations
Click to show internal directories.
Click to hide internal directories.