uuid

package
v0.5.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2025 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Error

type Error string
const (
	ErrFailedToGenerateUUID Error = "failed to generate UUID"
	ErrInvalidUUIDFormat    Error = "invalid UUID format"
	ErrInvalidUUIDLength    Error = "invalid UUID length"
	ErrInvalidUUIDHex       Error = "invalid UUID hex character"
	ErrFailedToDecodeUUID   Error = "failed to decode UUID"
)

func (Error) Error

func (e Error) Error() string

type UUID

type UUID [16]byte

UUID represents a universally unique identifier (UUID) as defined by RFC 4122. It is a 128-bit (16-byte) array, typically used for globally unique identification. The UUID is often represented as a 36-character string with hexadecimal digits and hyphens. UUIDs are used to uniquely identify objects or entities in distributed systems or databases.

func NewUUID

func NewUUID() (UUID, error)

NewUUID generates a new RFC4122 version 4 UUID using a cryptographic random source and returns it along with any error encountered during generation.

func ParseUUID

func ParseUUID(s string) (UUID, error)

ParseUUID parses a UUID string in the format "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx" and returns the corresponding UUID object.

func (UUID) String

func (g UUID) String() string

String converts the UUID to its standard string representation, formatted as 8-4-4-4-12 hexadecimal characters separated by dashes.

Jump to

Keyboard shortcuts

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