Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrInvalid = errors.New("object is invalid")
var ErrNilObject = errors.New("object is nil")
var Validate = validator.New(validator.WithRequiredStructEnabled())
Functions ¶
func IsValid ¶
IsValid will check if an object is valid according to the validation tags on the object. It does not return any details of validation issues, only a boolean for valid (true) or invalid (false).
func SanitizeBytes ¶ added in v0.148.0
SanitizeBytes attempts to "sanitize" a []byte value. It will strip any leading/trailing whitespace and then run the string through bluemonday to remove dangerous components. This should retain HTML5 content.
func SanitizeString ¶
SanitizeString attempts to "sanitize" a string value. It will strip any leading/trailing whitespace and then run the string through bluemonday to remove dangerous components. This should retain HTML5 content.
Types ¶
type Error ¶
type Error struct {
Details string
// contains filtered or unexported fields
}
Error is a map of fields and their validation errors.
func ParseStructValidationErrors ¶ added in v0.142.3
func ParseStructValidationErrors(validationErrors validator.ValidationErrors) *Error
ParseStructValidationErrors takes the underlying validation errors and formats them so that each struct field has an array of all validation errors associated with it.