uid

package
v0.0.0-...-7143b1a Latest Latest
Warning

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

Go to latest
Published: May 12, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package uid wraps ULID generation and validation for kata stable IDs.

Index

Constants

View Source
const EncodedLen = encodedLen

EncodedLen is the fixed character length of a Crockford base32-encoded ULID.

Variables

This section is empty.

Functions

func FromStableSeed

func FromStableSeed(seed []byte, t time.Time) (string, error)

FromStableSeed returns a deterministic ULID whose timestamp is t and whose 80-bit entropy is SHA-256(seed)[:10].

func FromTime

func FromTime(t time.Time) (string, error)

FromTime returns a ULID whose timestamp is t and whose entropy is random. It is not deterministic and must not be used for JSONL v1->v2 fill rules.

func Length

func Length() int

Length is the fixed character length of a kata ULID (Crockford base32).

func MustTime

func MustTime(s string) time.Time

MustTime extracts the timestamp from a valid ULID and panics on invalid input. It is intended for tests and invariant-checked call sites.

func New

func New() (string, error)

New returns a fresh monotonic ULID string.

func Valid

func Valid(s string) bool

Valid reports whether s is a strict 26-character ULID.

func ValidPrefix

func ValidPrefix(s string) bool

ValidPrefix reports whether s is a valid leftmost ULID prefix.

Types

This section is empty.

Jump to

Keyboard shortcuts

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