silvadanilo

silvadanilo

Ecto_command - a toolkit for mapping, validating, and executing commands

Hello guys,

I often find myself working on projects where I accept commands from external sources (usually via HTTP APIs, but they could also come through the shell or other means).
The input data needs to be validated before it can be used, and after trying out various validation libraries, I have come to the conclusion that it is probably best to leverage Ecto’s validation feature for this task.

However, I find Ecto a bit cumbersome and verbose when it comes to specifying fields and how they should be validated. For these and other reasons, I have created this library: GitHub - silvadanilo/ecto_command · GitHub.

This library allows you to specify which fields are available for a particular command, how they should be validated, and if the input data is valid, it allows the execution of that specific command.

I would appreciate any feedback and suggestions on how to improve the library. Please take a look at the GitHub repository and share your thoughts.

Thank you in advance for your support and contributions!

Most Liked

katafrakt

katafrakt

I’ve seen it somehow few weeks ago and I think it’s pretty cool implementation, if someone uses commands. I agree with you that Ecto input validation is great, but it’s tied a bit too much to persistence layer (at least conceptually) and is much harder to use outside of persistence contexts. This, in turn, lead to database-driven development. It’s freat to have an abstraction to overcome this.

Last Post!

katafrakt

katafrakt

Oh, I absolutely don’t mind the name. I use the name “command” for a wide variety of things, basically every self-contained unit of code that makes a change to the system state.

I wouldn’t, however, use your library for queries probably. I know some people would - and it’s fine. But for me personally queries are usually better off without this kind of abstraction.

Where Next?

Popular in Announcing Top

zorbash
I created Kitto a framework for dashboards inspired by Dashing. The distributed characteristics of Elixir and the low memory footprint...
New
wmnnd
Hi there, for my project DBLSQD, I needed a file storage solution that is a bit more flexible than Arc. Because I thought others might f...
New
Crowdhailer
Raxx is an alternative to Plug and is inspired by projects such as Rack(Ruby) and Ring(Clojure). 1.0-rc.1 is now available. To use it re...
New
mspanc
I am pleased to announce an initial release of the Membrane Framework - an Elixir-based framework with special focus on processing multim...
New
josevalim
Hi everyone, We would like to announce that Plataformatec is working on a new MySQL driver called MyXQL. Our goal is to eventually integ...
New
sorentwo
Hello! tl;dr Announcing Oban, an Ecto based job processing library with a focus on reliability and historical observability. After spen...
985 44778 311
New
dominicletz
Hi, I thought I had posted my library before but seems I hadn’t. The project is still in early stages but it’s growing and so I think it...
New

Other popular topics Top

minhajuddin
I have seen a lot of code which picks the first element from a list using Enum.at(0) instead of List.first. Is there a reason why people ...
New
dokuzbir
I want to highlight html closing tags when i click a html tag. That works in .html files but doesnt work for html.eex templates. How can...
New
nsuchy
Hi. I’ve noticed that Windows Powershell has it’s own IEX command and you cannot access Elixir’s IEX due to the conflict. This isn’t a cr...
New
bsollish-terakeet
Credo is smart enough to check for (something like) this: assert length(the_list) == 0 with this response: Checking if an enum is empt...
New
msaraiva
Surface is an experimental library built on top of Phoenix LiveView and its new LiveComponent API that aims to provide a more declarative...
564 44265 214
New
romenigld
I am trying to run a deploy with docker and I successfully runned with this command: docker build -t romenigld/blog-prod . but when I t...
New

We're in Beta

About us Mission Statement