// the find
woylie/flop
Filtering, ordering and pagination for Ecto
Flop adds filtering, sorting, and pagination (both offset and cursor-based) to Ecto queries, driven by user-supplied params that get validated against a per-schema whitelist. It's for Elixir/Phoenix developers building index endpoints or APIs who don't want to hand-roll dynamic Ecto.Query construction and validation every time.
Cursor pagination implements the actual GraphQL Relay Cursor Connections spec (first/after/last/before) rather than a bolted-on offset wrapper, and it ships Flop.Relay for absinthe_relay integration directly. Filterable/sortable fields are whitelisted per schema via Flop.Schema, so a client can't filter or sort on a column just because it exists on the struct. Three adapters (Postgres, MySQL, SQLite) are each tested in CI, and the docs are honest about adapter-specific traps like MySQL raising on cursor pagination over strings without the right collation. Join fields and compound fields (e.g. one filter spanning first_name/last_name) solve a real pain point people otherwise solve with ad hoc Ecto fragments.
Filters are AND-only — there's no OR support, which rules out a lot of real search-box use cases and isn't a trivial workaround. The UI layer (sortable tables, filter forms, pagination controls) lives in a separate package, Flop Phoenix, so this repo is the query engine only; expect a second dependency for anything user-facing. Outside of the Relay connection formatter there's no built-in response shaping for GraphQL or JSON:API, so non-Absinthe users are translating Flop.Meta by hand. Computed fields, embedded fields, and anything beyond plain columns are documented as recipes rather than supported natively, meaning JSON columns or derived values need custom adapter code.