Skip to main content

Module ids

Module ids 

Source
Expand description

Shared random resource-id generation.

Many services mint short resource ids by truncating a v4 UUID. Before this module each did it inline (Uuid::new_v4().simple().to_string()[..N]) or in a per-crate short_id helper with a slightly different length, which was a maintenance trap. These helpers centralise the idiom so a caller states the length it needs explicitly.

Functionsยง

alnum_id
A base-36 ([0-9a-z]) id of len characters, drawn from UUID entropy.
short_id
A lowercase-hex id of len characters, drawn from a v4 UUID.