aditya7iyengar

aditya7iyengar

Rummage.Ecto - Searching, Sorting and Pagination in Ecto & Phoenix

Rummage.Ecto and Rummage.Phoenix provide ways to perform Searching, Sorting and Pagination over Ecto queries and Phoenix collections.

For more details visit this blog

Here’s a little demo:

Most Liked

brightball

brightball

michalmuskala

michalmuskala

This looks like a great project - it has several issues, though (I’m speaking only about the ecto part - haven’t looked at others yet).

It injects a lot of code and functions inside __using__/1 - it is considered a bad practice. This leads to multiple issues - including slower compilation and inferior debugging experience.
It also couples schema to the repo module, which is something ecto actively avoids.

As an alternative, I could easily imagine a pure function-based interface, for example:

Rummage.Ecto.paginate(query, MyApp.Repo)
# instead of
MySchema.rummage(query)

The schema can be easily extracted from the query:

query = Ecto.Queryable.to_query(query)
{_source, schema} = query.from

One thing to note, though is that the schema can be nil, since it’s not required, but I also don’t see really a reason why it would be needed.

aditya7iyengar

aditya7iyengar

That’s a great suggestion! It will be great to not have a lot of code in __using__/1. I guess I have some work to do over this week. Thanks for your input!

aditya7iyengar

aditya7iyengar

Hi everyone!

I wrote a library which provides ways to perform Searching, Sorting and Pagination over Ecto queries and Phoenix collections: Rummage. Rummage has been split into two libraries: Rummage.Ecto and Rummage.Phoenix.

Rummage is a Ransack-like library, which is designed in the Elixir way. Which means no defining functions on the models, transparency and configurability!

Rummage comes with a lot of powerful features which are available right away, without writing a bunch of code. Here are a few blogs that talk about how to use Rummage in a Phoenix or an Ecto application:

Let me know if you have any thoughts on Rummage!

Thank you!

Here’s a little demo:
Rummage

aditya7iyengar

aditya7iyengar

Very interesting! I agree with the implementation problems with offset, however I question the cost of adding it to Rummage.Ecto vs the benefits it will provide. However, it would be fun to implement a custom hook for that. This is precisely why I made Rummage.Ecto configurable, which means you can write a simple pagination hook to do what you’re saying, while using its Search and Sort hooks with all the HTML support.

Where Next?

Popular in Libraries Top

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
mhanberg
I just released the first version of Temple: an HTML DSL for Elixir and Phoenix! You can read this blog post or the docs for more info...
New
tmbb
I’ve been working on two packages (not on hex.pm yet) to build admin interfaces for phoenix apps: bureaucrat - which contains a bunch ...
New
OvermindDL1
Been making an MLElixir thing (not released yet…) for fun in spare time in the past day. I’m just trying to see how much I can get an ML...
132 13487 106
New
archan937
It is a well-know topic within the Elixir community: “To mock or not to mock? :)” Every alchemist probably has his / her own opinion con...
New
Crowdhailer
I have been updating a library that allows you to pipe between functions that use the erlang result tuple convention. Assuming you have...
New
josevalim
Yes, yet another parser combinator library! Most of the parser combinators in the ecosystem are either compile-time, often using AST tra...
159 18262 141
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
OvermindDL1
I created a new library (rather I pulled out a couple files from my big project), it manages an operating system PID file for the BEAM. ...
New
Qqwy
While not as prevalent as in imperative languages, arrays (collections with efficient random element access) are still very useful in Eli...
New

Other popular topics Top

JDanielMartinez
Hi! May someone helps me, please! I have two apps into an umbrella project: the first one is Database, which manages queries, and the se...
New
yurko
Here are few pieces of (common) Linux knowledge that we use for reasonably small one server apps. We use Ubuntu but this should work for ...
New
Tee
can someone please explain to me how Enum.reduce works with maps
New
_russellb
I want to try my hand at web scraping. What tools/libraries do I need to use. I’m hoping to turn this into something professional so don’...
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
aadeshere1
I have a another noob question about loop. Since elixir is immutable, while loop is not directly possible. total = 10 while total != 0 ...
New
fayddelight
I tried installing elixir 1.11.2 erlang 23.3.4 via asdf in my zsh shell. Enabled the versions locally and globally. When I list them ...
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 42633 214
New
AstonJ
by Lance Halvorsen Elixir and Phoenix are generating tremendous excitement as an unbeatable platform for building modern web application...
460 27162 124
New
magnetic
Hey :wave:t3: Elixir community, I’ve been learning Elixir, and working on some side projects. My editor of choice is VSCode, and althoug...
New

Sub Categories:

We're in Beta

About us Mission Statement