defmodule Microwaveprop.Repo do use Ecto.Repo, otp_app: :microwaveprop, adapter: Ecto.Adapters.Postgres import Ecto.Query @doc """ Overrides `Ecto.Repo.all/2` to accept `:limit` and `:offset` as keyword options. Oban Pro 1.7's `DynamicLifeline` plugin passes `Repo.all(query, limit: n)` directly, which Ecto ≥ 3.13 rejects via `validate_query_opts!/2`. We fold those options into the query before delegating so downstream callers (our code included) don't have to change. """ defoverridable all: 2 @spec all(Ecto.Queryable.t(), Keyword.t()) :: [Ecto.Schema.t()] | [map()] def all(queryable, opts) do {limit, opts} = Keyword.pop(opts, :limit) {offset, opts} = Keyword.pop(opts, :offset) queryable = queryable |> then(fn q -> if limit, do: from(x in q, limit: ^limit), else: q end) |> then(fn q -> if offset, do: from(x in q, offset: ^offset), else: q end) super(queryable, opts) end end