ids

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Jun 12, 2026 License: AGPL-3.0 Imports: 1 Imported by: 0

Documentation

Overview

Package ids generates immutable resource identifiers.

Catalog rows use UUIDv7 as their primary key — time-sortable, std-blessed, 36-char canonical form. Generation is app-side; PG never invents an id.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func New

func New() string

New returns a new UUIDv7 string. Panics only if the system RNG fails.

func UnixSec

func UnixSec(s string) int64

UnixSec extracts the embedded creation time (seconds since epoch) from a UUIDv7 string. Returns 0 if s is not a parseable UUIDv7. UUIDv7 encodes milliseconds in the first 48 bits, so seconds-precision is exact.

Used by surfaces that expose OpenAI-shape `created` fields (e.g. /v1/models) without adding a separate CreatedAt column to every entity.

func Valid

func Valid(s string) bool

Valid reports whether s parses as a UUID (any version). Used at the admin boundary to reject malformed id path params before storage.

Types

This section is empty.

Jump to

Keyboard shortcuts

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