Skip to content

Instantly share code, notes, and snippets.

@ctrlShiftBryan
Last active May 4, 2016 20:36
Show Gist options
  • Select an option

  • Save ctrlShiftBryan/97632723db34d73bfab570d6a1e2da1c to your computer and use it in GitHub Desktop.

Select an option

Save ctrlShiftBryan/97632723db34d73bfab570d6a1e2da1c to your computer and use it in GitHub Desktop.
Struct As Params?
defmodule Foo.BarController do
use Foo.Web, :controller
defmodule ByKeyParams do
defstruct dob: "", last_name: "", request_id: ""
end
def by_key(conn, params) do
params = %ByKeyParams{} |> map.merge(params)
request = %Foo.Request{}
conn
|> render("request.json", request: request)
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment