README.md

ulid-0.1.0 documentation

Package

Name
ulid
Version
0.1.0
Uploaded
2026-07-30 22:55:51
Repository
https://github.com/tobyink/zuzu-ulid
Dependencies
Metadata
zuzu-distribution.json
Archive
Download .tar.gz

ulid

Generate Universally Unique Lexicographically Sortable Identifiers in ZuzuScript.

from ulid import create_ulid, create_ulid_binary, ulid_time;
from std/time import Time;

let text := create_ulid();
say text;
let raw := create_ulid_binary();
let historical := create_ulid( time: new Time(946684800) );
let timestamp := ulid_time(text);
let binary_timestamp := ulid_time(raw);

create_ulid() returns the canonical 26-character uppercase Crockford Base32 form. create_ulid_binary() returns the same 128-bit layout as a 16-byte BinaryString.

Each identifier contains a 48-bit Unix timestamp in milliseconds and an 80-bit random component generated by std/secure. Identifiers generated within the same millisecond use monotonic randomness so that later identifiers continue to sort after earlier ones.

Both functions accept an optional named time parameter containing a std/time Time object. If it is omitted, they use the current time.

ulid_time() accepts either a valid textual ULID or a 16-byte binary ULID, autodetects the form, and returns its timestamp as a Time object with millisecond precision. Text ULIDs are accepted case-insensitively; invalid values throw an exception.