bitcrowd/carbonite

Feature request: allow configrable ordering for Carbonite.Query.changes/2

Closed this issue · 3 comments

We use Carbonite with Flop and want to be able to have a paged result of changes ordered by {:desc, :id}.

I am happy to submit a PR to change the function Carbonite.Query.changes/2 to include something like this:

default_order = Keyword.get(opts, :default_order, {:asc, :id})
...
|> order_by(default_order)

and would be a bonus to not include any ordering if set to nil to offload the ordering to something like flop.

Any thoughts on this?

Hi @wkirschbaum

Happy to add this feature if you submit a PR. Maybe just call the option :order_by as the others are also without default_, and set to nil (maybe also false?) would make it disappear.

That said, if you want to save yourself some work, Map.put(query, :order_bys, []) removes the order_by clause from the query - granted, this is reaching into Ecto internals, but unlikely to ever change.

released as v0.14.1

@maltoe thank you :). I really appreciate the effort on this. Thanks for a great library, best auditing package I have used so far.