ids

package
v0.11.9 Latest Latest
Warning

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

Go to latest
Published: Oct 29, 2026 License: Apache-2.0 Imports: 1 Imported by: 1 module, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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