uid

package
v14.0.1 Latest Latest
Warning

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

Go to latest
Published: Nov 13, 2026 License: BSD-3-Clause Imports: 1 Imported by: 0

Documentation

Overview

Package uid provides tiny helpers over the standard library's uuid package for the two id shapes the framework generates: unpredictable version 4 ids and time-ordered version 7 ids.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewString

func NewString() string

NewString returns a new random (version 4) UUID in its canonical string form. Use it for identifiers that must be unpredictable and must not leak their creation time, such as token ids.

func NewV7String

func NewV7String() string

NewV7String returns a new time-ordered (version 7) UUID in its canonical string form. Use it for identifiers that are stored and looked up as keys: the timestamp prefix keeps neighboring inserts adjacent (storage-key locality), which databases and caches reward. Note that a v7 id embeds its creation time, so it is not suitable where that would be a leak. Session ids qualify: their 74 random bits keep them unguessable, and the moment a session was created is not a secret.

Types

This section is empty.

Jump to

Keyboard shortcuts

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