Separate the changeset logic from the insert/update logic
- Dominant language
- Elixir
- Stars
- 15
- Forks
- 2
- PR merge metrics
- No merged PRs in 30d
Description
I think that we should remove all the `__MODULE__.changeset` calls this module makes or provide alternative ways for the functions to be called that allow users to do this step themselves.
If we do this the functions can be made more flexible. We could allow users to call functions passing a changeset or a map as a parameter, something that is common when it comes to interacting with the database in a phoenix application. Currently we can only pass a map.
This could be an issue when trying to build associations between 2 or more tables. Ecto.changeset has functions like [`put_assoc(changeset, name, value, opts \\ [])`](https://hexdocs.pm/ecto/Ecto.Changeset.html#put_assoc/4) (and many others) which we would not be able to use with the module (not without a workaround anyway unless I am missing something).
I feel checking a changeset to make sure it is valid is one step and then using it to interact with a database is a separate step.
@Danwhy @nelsonic @Cleop @SimonLab Does anyone have any thoughts on the above? If I have missed anything in how this module is meant to be implemented or anyone has any thoughts (for or against the above) please let me know 👍
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.