std/identifier

Identifiers: the trait Identifier and its two types, Uuid (RFC 9562, versions 4 and 7) and Ulid, one IdentifierError for a text that is neither, and the urn:uuid: bridge to std/uri (docs/design/URI.md section 12).

The package is pure: randomness is a Random of std/random and the clock a Timestamp, both arguments, so it has no capability and a test needs no mock. It is not in the prelude; a program that makes identifiers names it.

use Uuid from "std/identifier"
use Random from "std/random"

var source = Random.seeded 42
const identifier = Uuid.version7(source, at: Timestamp.fromUnixNanoseconds 1_790_000_000_000_000_000)
print identifier

Modules

Everything