woylie
Flop is an Elixir library that applies filtering, ordering and pagination parameters to your Ecto queries.
- offset-based pagination with
offset/limitorpage/page_size - cursor-based pagination
- sorting
- filtering
- parameter validation
- configurable filterable and sortable fields
- join fields
- compound fields
- query and meta data helpers
- Relay connection formatter (edges, nodes and page info)
- UI helpers and URL builders through Flop Phoenix.
Trending in Announcing
Earmark is a pure-Elixir Markdown converter.
It is intended to be used as a library (just call Earmark.as_html), but can also be used as...
New
Edit: 2026 May 15 - This post is archived.
Mob is alive!!
Main docs: mob v0.7.11 — Documentation
A bit of explanation for the slightly c...
New
Hi, I would like to tell about my initiative to further maintain and develop Waffle project which is the fork of Arc library.
The progre...
New
I fully migrated to my own harness from Anthropic/Gemini and I think it’s time to share it. Welcome DSH, the DeepSeek Harness, fully writ...
New
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Hi everyone :waving_hand:
I’ve been working on PhiaUI, an open-source UI component library for Phoenix LiveView, and I wanted to share i...
New
Hello Elixir community!
I am excited to announce the release of a new Elixir library for interacting with the Ethereum blockchain: Ether...
New
Other Trending Topics
On November 23, 2026, an unauthorized third party exploited a vulnerability in hex.pm (CVE-2026-129514, CVSS 10.0) that let them run comm...
New
@hugobarauna, Dr. Dimitrios Koutmos (my brother) and I (Alex Koutmos) have been hard at work on writing a book on how you can use Elixir ...
New
Popcorn, the library that runs Elixir code in the browser, is now stable :popcorn:
This is possible because it now builds on a very stab...
New
If you haven’t tried Hologram yet, what’s stopped you?
Here’s why I’m asking. Building a framework turns out to be two jobs, the framewo...
New
@hugobarauna and I (Alex Koutmos) have been hard at work on writing a book on Nerves that takes you from simply blinking LEDs to building...
New
In my third year of college, around 2010, I found Erlang. A few years later, I found Elixir. I liked the ideas at once: many small proces...
New
Categories:
Sub Categories:
Forums
Popular Tags
- #ecto
- #liveview
- #troubleshooting
- #learning-elixir
- #library
- #deployment
- #erlang
- #testing
- #genserver
- #mix
- #absinthe
- #remote-other
- #otp
- #plug
- #how-to-question
- #macros
- #postgres
- #elixirconf
- #channels
- #code-sync
- #exunit
- #discussion
- #podcasts
- #javascript
- #onsite
- #dialyzer
- #docker
- #ai
- #authentication
- #elixirconf-us
- #umbrella
- #full-time-contract
- #podcasts-by-brainlid
- #blog-post
- #ecto-query
- #elixir-ls
- #phoenix_html
- #iex
- #graphql
- #genstage
- #websockets
- #supervisor
- #advent-of-code
- #elixirconf-eu
- #distillery
- #security
- #processes
- #api
- #forms
- #hex











Showing Posts 1 to 10- Show Best Posts
- Show All (oldest first)
- Show All (newest first)
Nefcairon
I found Flip and Flop_Phoenix a few days ago on GitHub and since then I’ve waited for this thread
Will definetly use it, very nice work
Is there a small demo project available? As a beginner this is the best way for me to learn how to use a library.
woylie
There is no demo project at the moment, but there are step-by-step instructions in the readmes. If something is unclear, let me know, so that I can improve the documentation
mayel
Nice work! Can it join+preload associations and filter using fields from associations? This seems to be what’s missing from many of the similar libs.
woylie
It can not add join expressions or preload data for you. Flop does not try to be an alternate query DSL - it just adds
WHERE,ORDER BYandLIMITclauses derived from user-generated parameters to existing Ecto queries.However, you can define join fields, which are basically a mapping from a field alias to a field name on a named binding (see join fields). You will have to ensure that the necessary named bindings are added to the Ecto query you pass to the Flop functions. This approach means that you can filter and sort by anything that Ecto allows to join on: not only associations, but also the results of subqueries. To avoid unnecessary joins, you can retrieve a list of necessary bindings for a given parameter map before building the query (see Flop.bindings/3).
bjuretic
Hi, just trying out your package, thanks for making it.
Is it possible (for me as a package user) to add a way to find out if there is more records, in cursor-based pagination?
Ideally I would like actually to know if there are records before the first and after the last entities (“page”) currently fetched.
That means running min/max postgres functions on the query, without LIMIT and sorting on it.
Any ideas are welcome, and it does not have to be super-optimized.
Thanks!
woylie
If you run a cursor-paginated query, Flop will make the query with the given limit + 1 (
first,last, ordefault_limit). The*runfunctions will remove the extra row from the result set. The returnedFlop.Metastruct hashas_next_page?orhas_previous_page?fields, where the value of one of the fields depends on the existence of the extra row, and the other one depends on the presence of aafterorbeforeparameter.bjuretic
Thanks. Is it possible to do a range/between filtering on the same field with this library? For example records between two dates.
woylie
Yes, filters are passed as a list, you can combine as many as you want, including ones on the same field. All filters are combined with a logical
AND. One thing that isn’t possible at the moment is combining multiple filters with a logicalOR. (If you want to filter a single string field, there areilike_orandlike_oroperators`, though.)brightball
Have you given any thought to including this approach for performance in a future release?
Otherwise, looks great!
woylie
That is already implemented! You can choose between offset-based and cursor-based pagination. See also:
Flop.Phoenix has two different UI components for offset-based and cursor-based pagination.