Documentation
¶
Overview ¶
Package uuid wraps github.com/google/uuid with the string / hex id shapes services actually pass around, so callers don't re-do .String() or the hex-encode dance at every call site. Generating the UUID itself is left to google/uuid — a mature, correct implementation is not worth reinventing.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New() string
New returns a time-ordered resource ID as a 32-character lowercase V7 hex string.
func NewWithPrefix ¶
NewWithPrefix returns a time-ordered resource ID in "prefix_<v7hex>" form. An empty prefix returns the same bare V7 hex value as New.
func V4 ¶
func V4() string
V4 returns a random (version-4) UUID in canonical dashed form. On the practically impossible entropy failure it returns the zero UUID rather than panicking — these are correlation ids, where a crash is the worse trade.
func V7 ¶
func V7() string
V7 returns a time-ordered (version-7) UUID in canonical dashed form. google/uuid keeps ordering even within a single millisecond, so these sort by creation time — the property DB keys and sequential resource ids want, which V4's uniform randomness scatters. Zero-UUID fallback on entropy failure, like V4.
func V7Hex ¶
func V7Hex() string
V7Hex returns a version-7 UUID as a 32-character lowercase hex string with no dashes — the compact id shape services use for DB keys, pod-name suffixes and correlation ids, where the canonical dashed form is noise. Same ordering and fallback as V7; always 32 hex characters.
Types ¶
This section is empty.