Background
I am moving towards defined data structures in my application, and I find that TypedStruct is quite useful.
Questions
However, I have recently found a little hickup. I don’t know how to convert this definition into a typedstruct:
@type order_info :: %{
(visible :: String.t()) => boolean,
(order_type :: String.t()) => String.t(),
(platform :: String.t()) => String.t(),
(platinum :: String.t()) => non_neg_integer,
(user :: String.t()) => %{
(ingame_name :: String.t()) => String.t(),
(status :: String.t()) => String.t()
}
}
My main issue here is the user map. Aside from the fact I don’t know how to define a typedstruct inside a trypedstruct, how do you folks do this?
- Do you simply define a map inside the
order_infotypedstruct and ignore the mandatory parameters for theusermap? - Do you create another typedstruct (called
user) that goes inside the typedsctruct calledorder_info? - What is the standard option in Elixir ?