I am using a CSV module to import a CSV file, this stores the data in a map, that all works, giving me the usual data mapping result. I then need to take that mapped data and send it to ecto.repo. This is using the standard attrs argument that is then unpacked and sent to the changeset to be sent to the database. How do I iterate over each key and return the value and then take each sub value and pass it to ecto.repo.create_object?
%{{:ok, ["key", "key", "key"]} => {:ok, ["value", "value", "value"}}..}
All the keys and values are mapped exactly the same, so each key is the same value as the value. The other thing is, I don't know the name of the key so I can't call each key. Furthermore each set of key, value pairs is a separate line in the CSV file, and I need to pass each line into ecto.repo.create_object to be entered into the database. Basically creating a new record for each line of the CSV file. What is the best way to achieve this?