Using Ecto in my data layer WDD

So I’ve been reading the two fantastic prag-prog books Designing Elixir Systems with OTP and Functional Web Development with Exlir OTP. Essentially they speak about separating your domain logic from the outside world a functional take on good old DDD.

I’m building my next project using these methods (WDD) and I was thinking of using embedded ecto shemas for my data layer. Using Ecto at this layer feels somewhat wrong since it is such a diverse library but I’m a big fan of changeset validations and that would be the main reason for me using it in my data layer. Does anyone have a solid opinion for or against using it?

I’m leading more towards just using it knowing the potential downsides of my somewhat in-pure(not in the functional sense) data layer.

As an aside is there any goto validation library in the Elixir community that I could use instead of bringing the whole Ecto eco system just essentially for validation?

1 Like

You do not import all ecto, just ecto, not ecto_sql…

An alternative I wanted to try is typecheck, and use simple struct.

2 Likes