View Source jhn_typeid (jhn_stdlib v5.3.3)
A UUID library based on: TypeID Specification (Version 0.3.0) https://github.com/jetify-com/typeid/tree/main/spec
A library for generating typeids.
Functions for encoding/decoding UUIDs are provided for completness and testing purposes and the select few occations they are actually needed.
A decoded typeid is represented as a map:
* human (default for decode): UUID format with human readbable timestamp
#{prefix => <<"oid">>, uuid => #{timestamp => <<"2024-09-30T08:15:06.266Z">>, version => 7, random => 486766668076239088766}}
* uuid: Standard encoded UUIDv7 format
#{prefix => <<"oid">>, uuid => <<"019241ff-581a-7069-a33e-999d70b4ec7e">>}
* hex: Non-standard encoded UUIDv7 hex format without dashes
#{prefix => <<"oid">>, uuid => <<"019241ff581a7069a33e999d70b4ec7e">>}
Summary
Functions
Generates the an TypeId as an iolist.
Generates the an TypeId as an iolist.
Encodes the an TypeId as an iolist.
Encodes the an TypeId with the format determined by the Opts.
Generates the an TypeId as a binary.
Generates the an TypeId as an iolist.
Generates the an TypeId with the format determined by the Opts.
Verifies that a binary is a valid prefix for a typeid
Types
-type format_opt() :: hex | uuid | human.
-type return_type() :: iolist | binary | list | typeid.
Functions
Generates the an TypeId as an iolist.
Equivalent of decode(TypeIdMap, []).
-spec decode(binary(), [format_opt()]) -> map().
Generates the an TypeId as an iolist.
Equivalent of decode(TypeIdMap, []).
Encodes the an TypeId as an iolist.
Equivalent of encode(TypeIdMap).
Encodes the an TypeId with the format determined by the Opts.
Options: iolist -> an iolist is returned list -> a list is returned typeid -> a typeid map is returned
-spec gen() -> binary().
Generates the an TypeId as a binary.
Equivalent of gen(<<>>)
.
Generates the an TypeId as an iolist.
Equivalent of gen(Prefix, []).
Generates the an TypeId with the format determined by the Opts.
Options: iolist -> an iolist is returned list -> a list is returned typeid -> a typeid map is returned
Verifies that a binary is a valid prefix for a typeid