Allow repo opts to be passed to paginate/2
Right now we only can pass :prefix repo opt to Repo.paginate/2 but it should behave like a normal repo operation where the user can pass arbitrary/predefined repo options such as those indicated in https://hexdocs.pm/ecto/Ecto.Repo.html#module-shared-options
For example, we should be able to pass :log and :admin as opts to Repo.paginate/2 like this:
Scrivener.Ecto.Repo.paginate(Post, options: [log: true, admin: true])
Now the query will be logged and we can use the arbitrary opts such as admin in the prepare_query/3 callback like so:
@impl true
def prepare_query(_operation, query, opts) do
if opts[:admin] do
{query, opts}
else
query = from(x in query, where: is_nil(x.deleted_at))
{query, opts}
end
end
This would be a lovely feature to have.
My use case is trying to pass the timeout option.
Neat! I am also hoping for the timeout option to be passable.
@dgigafox are you able to manually run tests on your PR screen? or maybe push an empty commit to trigger the test workflow please?
The maintainer added a test hook for PRs in June after this was opened in May. I'm curious if green tests would make this easier to merge 🙏
Thanks!
Oh wait, your commit was a year later 🤦 . nevermind me 😅