talira

UUID generation, parsing and formatting for Elixir

open sourceApache-2.0free

Uniq is Paul Schoenfelder's Elixir library for generating, formatting, parsing and analysing UUIDs as RFC 9562 defines them. It generates versions 1, 3, 4, 5, 6 and 7, parses those and opaque UUIDv8 payloads, and formats UUIDs as canonical strings, URNs or a compact 22-character URI-safe base64 form. It works as an Ecto field type in place of Ecto.UUID and can replace elixir_uuid.

Problems it solves

  • generate time-ordered UUIDv7 primary keys in my Elixir app
  • store UUIDs in a short URL-safe form in Elixir
  • replace elixir_uuid with a maintained UUID library
  • parse and validate UUID strings in either case in Elixir

Features

  • generates UUID versions 1, 3, 4, 5, 6 and 7
  • parses those versions and opaque UUIDv8 payloads
  • reversible UUIDv47 timestamp masking as v4-shaped facades
  • canonical, URN and compact 22-character base64 formats
  • Ecto field type in place of Ecto.UUID

Alternatives

The same job

These do what Uniq does.

  1. uuid (Erlang) Erlang native UUID generation
  2. Nanoid (Elixir) Elixir port of Nano ID, a tiny, secure, URL-friendly unique ID generator

Compare Uniq with the top 3