Uniq.UUID.info
info
, go back to Uniq.UUID module for more information.
Specs
info(binary(), :struct) :: {:ok, info()} | {:error, term()}
info(binary(), :keyword) :: {:ok, Keyword.t()} | {:error, term()}
This function parses the given UUID, in any of the supported encodings/formats, and produces the information gleaned from the encoded data.
Two styles of information are supported, depending on whether the function is called via
the compatibility shim for :elixir_uuid
, or directly. You may pass :struct
or :keyword
manually if you wish to express a preference for one style or the other.
The :struct
form is the UUID structure used internally by this library, and it contains all
of the information needed to re-encode the UUID as binary.
The :keyword
form matches 1:1 the keyword list produced by UUID.info/1
provided by the
:elixir_uuid
library, and it contains slightly less information, but is useful for compatibility
with legacy code that operates on that structure.
Examples
iex> Uniq.UUID.info("870df8e8-3107-4487-8316-81e089b8c2cf", :keyword)
{:ok, [uuid: "870df8e8-3107-4487-8316-81e089b8c2cf",
binary: <<135, 13, 248, 232, 49, 7, 68, 135, 131, 22, 129, 224, 137, 184, 194, 207>>,
type: :default,
version: 4,
variant: :rfc4122]}
iex> Uniq.UUID.info("870df8e8-3107-4487-8316-81e089b8c2cf")
{:ok, %Uniq.UUID{
format: :default,
version: 4,
variant: <<2::2>>,
time: 326283406408022248,
seq: 790,
node: <<129, 224, 137, 184, 194, 207>>,
bytes: <<135, 13, 248, 232, 49, 7, 68, 135, 131, 22, 129, 224, 137, 184, 194, 207>>,
}}