uuidgen

package
v1.18.1 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2026 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MustNewForEntity

func MustNewForEntity(entityType EntityType) uuid.UUID

MustNewForEntity is like NewForEntity but panics on error. Should only be used in situations where UUID generation failure is unrecoverable. SEM@54ce780187c82c328300f63352fb57ca67a12d0c: generate a UUID for an entity type, panicking on failure (pure)

func MustNewForEntityString

func MustNewForEntityString(entityType string) uuid.UUID

MustNewForEntityString is like NewForEntityString but panics on error SEM@54ce780187c82c328300f63352fb57ca67a12d0c: generate a UUID for a string-typed entity name, panicking on failure (pure)

func MustNewV4

func MustNewV4() uuid.UUID

MustNewV4 is like NewV4 but panics on error SEM@54ce780187c82c328300f63352fb57ca67a12d0c: generate a random UUIDv4, panicking on failure (pure)

func MustNewV7

func MustNewV7() uuid.UUID

MustNewV7 is like NewV7 but panics on error SEM@54ce780187c82c328300f63352fb57ca67a12d0c: generate a time-ordered UUIDv7, panicking on failure (pure)

func NewForEntity

func NewForEntity(entityType EntityType) (uuid.UUID, error)

NewForEntity generates a UUID appropriate for the given entity type. High-volume entities (threats, metadata) use UUIDv7 for better index locality. All other entities use UUIDv4 for compatibility and distribution. SEM@54ce780187c82c328300f63352fb57ca67a12d0c: generate a UUID selecting v7 for high-volume entities and v4 for all others (pure)

func NewForEntityString

func NewForEntityString(entityType string) (uuid.UUID, error)

NewForEntityString is a convenience wrapper that accepts string entity types SEM@54ce780187c82c328300f63352fb57ca67a12d0c: generate a UUID for a string-typed entity name, delegating to NewForEntity (pure)

func NewV4

func NewV4() (uuid.UUID, error)

NewV4 generates a UUIDv4 for entities that should use random UUIDs SEM@54ce780187c82c328300f63352fb57ca67a12d0c: generate a random UUIDv4 (pure)

func NewV7

func NewV7() (uuid.UUID, error)

NewV7 generates a UUIDv7 for entities that benefit from time-ordered UUIDs SEM@54ce780187c82c328300f63352fb57ca67a12d0c: generate a time-ordered UUIDv7 (pure)

Types

type EntityType

type EntityType string

EntityType represents the different entity types in the system SEM@54ce780187c82c328300f63352fb57ca67a12d0c: string type discriminating entity categories for UUID version selection (pure)

const (
	EntityTypeThreat   EntityType = "threat"
	EntityTypeMetadata EntityType = "metadata"
)

Jump to

Keyboard shortcuts

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