ecto-cursor-based-stream
ecto-cursor-based-stream copied to clipboard
Feature request: Add support for streaming in descending order
trafficstars
Currently, the library only supports streaming records in ascending order. This limitation can be problematic for use cases where descending order is required, such as retrieving the most recent records first.
Proposed enhancement: Add an option to stream records in descending order. This could be implemented by:
- Adding a new option to the
cursor_based_stream/2function, e.g.,order: :desc(default would remain:asc). - Modifying the query construction logic to support DESC ordering when this option is specified.
- Adjusting the cursor generation and comparison logic to work correctly with descending order.
Example usage:
Post
|> MyRepo.cursor_based_stream(order: :desc)