Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for nested structs #8

Closed
anronin opened this issue Apr 22, 2016 · 2 comments
Closed

Support for nested structs #8

anronin opened this issue Apr 22, 2016 · 2 comments

Comments

@anronin
Copy link
Contributor

anronin commented Apr 22, 2016

It will be nice if you can pass a few structs and get something like:
from
%{"Command" => "string", "Created" => 1459328030, "HostConfig" => %{"NetworkMode" => "default"}}
to
%Container{command: "string", created: 1459328030, %HostConfig{network_mode: "default"}}

if it possible. Maybe from nested module:

defmodule Constructor do

  defmodule Container do
    defstruct command: 1, created: 2, host_config: 3

    use ExConstructor
  end

  defmodule HostConfig do
    defstruct network_mode: 1 #(or 4)

    use ExConstructor
  end
end
@jschoch
Copy link

jschoch commented Jan 3, 2017

Looks like nested structs are working here: SLOBYYYY/exconstructor

Can this be merged in?

@gamache
Copy link
Contributor

gamache commented Feb 1, 2017

@jschoch Sorry for the delayed reply. The PR you reference doesn't make nested structs work in a configurable way. I like the syntax proposal in #18, so I am going to use that as the active ticket for this going forward. 👍

@gamache gamache closed this as completed Feb 1, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants