As the title says, can someone advises on the best way to remove the duplication in the code snippet below.
I am referring to the field list. By the way is there a way to retrieve that field list from any struct - did not find anything in the doc.
Many thanks.
S
defmodule Company do
@type t :: %__MODULE__{
id: integer,
name: String.t,
domain: String.t,
rating: float
}
@enforce_keys [:id, :name, :domain, :rating]
defstruct [:id, :name, :domain, :rating]
end