4 ms·
> we wanted it to work with whatever database While this is an option, making an app work with different database backends is not usually why one picks a libra
by isodev 2y ago
> we wanted it to work with whatever database
While this is an option, making an app work with different database backends is not usually why one picks a library like Ecto or ActiveRecord.
You see, these frameworks bring a tone of facilities for working with data, adding common solutions so we don't have re-invent the wheel every time. Everything from sanitation of user inputs and query building to creating update statements, validating input data and generating validation messages. Ecto is smart enough to even offer facilities for creating and handling forms based on the provided schema of the data. It also works with virtual data (not backed by a database) and all that can happen in Elixir, the same language as the rest of the application. For me, this has the advantage that I can focus on building what my app is supposed to do.
Of course, if you really want or need to, there is always an option to submit your "direct SQL" query, and you will be free to write all the boilerplate needed to handle that.