uid

package
v2.2.4 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2025 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateKSUID

func GenerateKSUID() string

GenerateKSUID returns a new KSUID (K-Sortable Unique Identifier) as a string. KSUIDs are 27-character, time-sortable identifiers that include a timestamp and random payload. This is ideal for systems that benefit from roughly ordered unique IDs (e.g., logs, events).

Example:

kid := GenerateKSUID()
fmt.Println(kid) // "0ujtsYcgvSTl8PAuAdqWYSMnLOv"

func GenerateUUID

func GenerateUUID() string

GenerateUUID returns a new RFC 4122 UUID (Universally Unique Identifier) as a string. This is useful for creating unique keys, tokens, or identifiers in distributed systems.

Example:

id := GenerateUUID()
fmt.Println(id) // "6ba7b810-9dad-11d1-80b4-00c04fd430c8"

Types

This section is empty.

Jump to

Keyboard shortcuts

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