Elixir :map

Hi all, what should input to field(:test, :map)?

field(:test, {:array, :map}) => name: [%{“name1” => “test”, “name2” => “test”}]

field(:test, :map) => ???

Can you please elaborate your question? Where does the field/2 function come from? What is meant by =>?

Hi, Thanks for reply.
just a schema table, i want to know what value should be input in field(:test1, :map).

schema “tablename” do
field(:id, :integer)
field(:name, :string)
field(:test1, :map)
field(:test2, {:array, :map})
end

because i know field(:test2, {:array, :map}) input like this
test: [%{“name1” => “test”, “name2” => “test”}] ,
but i dun know what value should be input in field(:test1, :map).

So this question is related to ecto?

From its documentation it seems as if :map simply maps over to elixirs map type, eg: %{} or %{"foo" => 2}.

3 Likes

Yes, correct . Thanks for answer.