Skip to content

Instantly share code, notes, and snippets.

@Tim-Machine
Created May 1, 2016 18:22
Show Gist options
  • Select an option

  • Save Tim-Machine/a11d53c1aa7dcbe36fa975b9f8979e69 to your computer and use it in GitHub Desktop.

Select an option

Save Tim-Machine/a11d53c1aa7dcbe36fa975b9f8979e69 to your computer and use it in GitHub Desktop.
@doc """
takes a map and converts it to a query string
example build_qeury_string %{locale: "en_US", another: "test"}
"""
def build_query_string(data) when is_map(data) do
data = for {key, val} <- data, into: [], do: "#{key}=#{val}"
Enum.join(data, "&")
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment