IDUtils.Scheme.Catalog (id_utils v0.1.0)

Copy Markdown View Source

Catalog of identifier schemes supported by IDUtils.

Summary

Types

t()

A keyword list of scheme modules.

Functions

Returns the ordered scheme mapping.

Extends the built-in scheme catalog with custom schemes.

Lists the names of all built-in supported schemes.

Returns the module associated with a scheme name.

Returns the name associated with a scheme module.

Types

t()

@type t() :: [{atom(), module()}]

A keyword list of scheme modules.

Functions

all()

@spec all() :: t()

Returns the ordered scheme mapping.

Note: The order of the schemes is important for detecting schemes correctly. If you work with this data structure, make sure to preserve its order.

extend(custom_schemes)

@spec extend(t()) :: t()

Extends the built-in scheme catalog with custom schemes.

This function will simply append custom schemes to the built-in catalog. It raises an ArgumentError if a custom scheme key already exists in the built-in catalog. For advanced customization, use all/0 and modify the resulting t/0 directly.

Parameters

  • custom_schemes - A list of custom schemes to append to the built-in list.

list()

@spec list() :: [atom()]

Lists the names of all built-in supported schemes.

module_for(scheme_name, scheme_list \\ all())

@spec module_for(atom(), [] | t()) :: {:ok, module()} | {:error, :unknown_scheme}

Returns the module associated with a scheme name.

Parameters

  • scheme_name - The name of the scheme to look up.
  • scheme_list - An optional list of schemes (defaults to the built-in list).

name_for(scheme_module, scheme_list \\ all())

@spec name_for(module(), [] | t()) :: {:ok, atom()} | {:error, :unknown_scheme}

Returns the name associated with a scheme module.

Parameters

  • scheme_module - The scheme module to look up.
  • scheme_list - An optional list of schemes (defaults to the built-in list).