Azure.Storage.Utilities (azure v0.2.3) View Source
Utilities
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
Adds a value to a list, which is a value in a dictionary.
Examples
iex> %{foo: nil} |> Azure.Storage.Utilities.add_to(:foo, :a)
%{foo: [:a]}
iex> %{foo: [:a]} |> Azure.Storage.Utilities.add_to(:foo, :b)
%{foo: [:b, :a]}
iex> %{foo: [:a]} |> Azure.Storage.Utilities.add_to(:foo, :b) |> Azure.Storage.Utilities.add_to(:foo, :c)
%{foo: [:c, :b, :a]}
Reverses a map
Examples
iex> %{read: "r", write: "w"} |> Azure.Storage.Utilities.reverse_map()
%{"r" => :read, "w" => :write}
iex> %{"r" => :read, "w" => :write} |> Azure.Storage.Utilities.reverse_map()
%{write: "w", read: "r"}
iex> %{"r" => :read, "w" => :write} |> Azure.Storage.Utilities.reverse_map()
%{read: "r", write: "w"}
Converts a list of atoms to a representative string, based on a mapping table.
Examples
iex> [:read, :write] |> Azure.Storage.Utilities.set_to_string(%{read: "r", write: "w"})
"rw"
iex> [:read, :write, :update] |> Azure.Storage.Utilities.set_to_string(%{read: "r", write: "w", create: "c"})
"rw"
Converts a string with shortcuts back into a list of atoms.
Examples
iex> "rw" |> Azure.Storage.Utilities.string_to_set(%{read: "r", write: "w", create: "c"})
[:read, :write]