Documentation
¶
Overview ¶
Package validation provides custom validation rules for the application.
Package validation provides custom validation rules for the application.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Base64 = validation.By(func(value interface{}) error { s, ok := value.(string) if !ok { return validation.NewError("validation_base64_type", "must be a string") } if s == "" { return nil } _, err := base64.StdEncoding.DecodeString(s) if err != nil { return validation.NewError("validation_base64", "must be valid base64-encoded data") } return nil })
Base64 validates that a string is valid base64-encoded data.
View Source
var NotBlank = validation.NewStringRuleWithError( func(s string) bool { return strings.TrimSpace(s) != "" }, validation.NewError("validation_not_blank", "must not be blank"), )
NotBlank validates that a string is not empty after trimming whitespace
Functions ¶
func WrapValidationError ¶
WrapValidationError wraps validation errors as domain ErrInvalidInput.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.