URN (URN v1.0.0) View Source

Uniform Resource Name tooling.

URNs are a smaller subset of URIs. Both share a scheme and the same encoding directives.

For more indepth knowledge about what a URN is, check out RFC8141.

Link to this section Summary

Functions

Checks if two URNs are equal.

Parses a urn string into it's various parts.

Link to this section Types

Specs

reason() :: String.t() | term()

Specs

t() :: %URN{
  fragment: term(),
  nid: term(),
  nss: term(),
  query: term(),
  resolution: term()
}

Link to this section Functions

Checks if two URNs are equal.

Something to note, when comparing URNs, resolution, query, and fragments are ignored. This is outlined in the spec.

Link to this function

new(nid, nss, opts \\ [])

View Source

Specs

new(String.t(), String.t(), []) :: t() | {:error, reason()}

Specs

parse(String.t()) :: {:ok, t()} | {:reason, reason()}

Parses a urn string into it's various parts.

Example

{:ok, urn} = URN.parse("urn:example:a123,z456?+abc")

Specs

parse!(String.t()) :: t()

Specs

to_string(t()) :: String.t()