uuid

package
v3.0.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 5, 2025 License: MIT Imports: 4 Imported by: 0

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

View Source
const (
	CodeUUIDInvalid = "string.uuid.invalid"
)

UUID-specific error codes

View Source
const KUUID types.Kind = "uuid"

KUUID is the rule kind for UUID validation.

Variables

This section is empty.

Functions

func DefaultUUIDTranslations

func DefaultUUIDTranslations() map[string]string

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL