Documentation
¶
Overview ¶
Package uuid provides UUID validation as a plugin.
The uuid package implements canonical UUID format validation with support for standard UUID format validation, hyphen placement verification, hexadecimal character validation, and custom error messages and translations. The package registers itself as a plugin with the main validation system and provides strict format checking for canonical UUID representations using the standard format: xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx where each 'x' is a hexadecimal digit (0-9, a-f, A-F).
Index ¶
Constants ¶
const (
CodeUUIDInvalid = "string.uuid.invalid"
)
UUID-specific error codes
const KUUID types.Kind = "uuid"
KUUID is the rule kind for UUID validation.
Variables ¶
This section is empty.
Functions ¶
func DefaultUUIDTranslations ¶
DefaultUUIDTranslations returns default English translations for UUID validation errors.
func RegisterUUIDType ¶ added in v3.0.3
func RegisterUUIDType()
RegisterUUIDType registers the UUID type in the global registry.
Types ¶
type UUIDTypeValidator ¶ added in v3.0.3
type UUIDTypeValidator struct {
// contains filtered or unexported fields
}
UUIDTypeValidator implements types.TypeValidator for UUID validation.
func (*UUIDTypeValidator) Validate ¶ added in v3.0.3
func (v *UUIDTypeValidator) Validate(value any) error
Validate validates a value as a UUID.
type UUIDTypeValidatorFactory ¶ added in v3.0.3
type UUIDTypeValidatorFactory struct{}
UUIDTypeValidatorFactory creates UUID type validators.
func (*UUIDTypeValidatorFactory) CreateValidator ¶ added in v3.0.3
func (f *UUIDTypeValidatorFactory) CreateValidator(translator translator.Translator) types.TypeValidator
CreateValidator creates a new UUID type validator.