Microsoft.Azure.Storage.Utilities (ex_microsoft_azure_storage v0.1.0)
Link to this section Summary
Functions
Adds a value to a list, which is a value in a dictionary.
Reverses a map
Converts a list of atoms to a representative string, based on a mapping table.
Converts a string with shortcuts back into a list of atoms.
Link to this section Functions
Link to this function
add_to(v, key, value)
Adds a value to a list, which is a value in a dictionary.
Examples
iex> %{foo: nil} |> Microsoft.Azure.Storage.Utilities.add_to(:foo, :a)
%{foo: [:a]}
iex> %{foo: [:a]} |> Microsoft.Azure.Storage.Utilities.add_to(:foo, :b)
%{foo: [:b, :a]}
iex> %{foo: [:a]} |> Microsoft.Azure.Storage.Utilities.add_to(:foo, :b) |> Microsoft.Azure.Storage.Utilities.add_to(:foo, :c)
%{foo: [:c, :b, :a]}
Link to this function
reverse_map(mapping)
Reverses a map
Examples
iex> %{read: "r", write: "w"} |> Microsoft.Azure.Storage.Utilities.reverse_map()
%{"r" => :read, "w" => :write}
iex> %{"r" => :read, "w" => :write} |> Microsoft.Azure.Storage.Utilities.reverse_map()
%{write: "w", read: "r"}
iex> %{"r" => :read, "w" => :write} |> Microsoft.Azure.Storage.Utilities.reverse_map()
%{read: "r", write: "w"}
Link to this function
set_to_string(set, mapping)
Converts a list of atoms to a representative string, based on a mapping table.
Examples
iex> [:read, :write] |> Microsoft.Azure.Storage.Utilities.set_to_string(%{read: "r", write: "w"})
"rw"
iex> [:read, :write, :update] |> Microsoft.Azure.Storage.Utilities.set_to_string(%{read: "r", write: "w", create: "c"})
"rw"
Link to this function
string_to_set(string, mapping)
Converts a string with shortcuts back into a list of atoms.
Examples
iex> "rw" |> Microsoft.Azure.Storage.Utilities.string_to_set(%{read: "r", write: "w", create: "c"})
[:read, :write]