EctoShorts - A library to help compose and create ecto queries with ease

Hello everyone!

I wanted to introduce EctoShorts to everyone here at the forum.

This was one of the first libraries I created and have been using in production apps for over 5 years. I decided to open source it a few years ago and have been using it across multiple companies, including the most recent company I’m at https://blitz.gg, where it’s used for almost all our ecto code. We use this to ingest and manage hundreds of billions of rows within Postgres, with millions of new rows being created daily (tl;dr it works at scale). It’s so useful, I even teach how to use it as a part of my course, so that developers can move quickly and focus on what matters!

I’m posting this now because I created this blog post to go alongside it, explaining a bit of the rationale and reasoning for creating this library, as well as some tips on how to work with it best! Not only that but I recently released 1.1.0 which includes the ability to query on relations as well now!

10 Likes

very cool! i found myself remplementing a certain pattern over and over again and i think the result is pretty much what you’re doing here.

just to check (and let you know of interest) does this support comparison of dates?

image

Dates do work since they’re simple > or < operations in ecto!

1 Like

It was unbelievable for me at first! Such a cool feature!

I realize I forgot to comment on HOW to do > and < filters. For this we have %{field: %{gt: value}} or %{field: %{lte: value}}

Hope this helps! There’s some cool filters on the todo list, like or queries and preloads and that would cover almost 90% of my querying use case, if there’s any others that you feel are missing let me know

1 Like