Documentation
¶
Overview ¶
Package idgen produces ULID-format document IDs for Den.
IDs are 26-character Crockford base32 strings — 10 chars of 48-bit millisecond timestamp followed by 16 chars of 80-bit randomness — and are strictly monotonic within the same millisecond. The wire format matches the ULID spec at https://github.com/ulid/spec, so IDs are drop-in compatible with any external tooling that parses ULIDs.
Monotonicity matters because Den uses the document ID as the default sort key (Sort("_id"), cursor pagination via After/Before). Two inserts in the same millisecond with random tails would sort unpredictably, occasionally letting a fresh row land "before" a previous cursor.
The intra-millisecond step is a fresh 32-bit crypto/rand draw, not +1, so two consecutive IDs from the same millisecond don't reveal the next. Across millisecond boundaries the randomness is fully re-seeded.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
This section is empty.