Skip to content

feat(query): before pagination#59

Merged
TorstenDittmann merged 7 commits intomainfrom
before-pagination
Oct 4, 2021
Merged

feat(query): before pagination#59
TorstenDittmann merged 7 commits intomainfrom
before-pagination

Conversation

@TorstenDittmann
Copy link
Copy Markdown
Contributor

Adds the ability to paginate before an id.

Technically, it will be done the way after is paginated - just that the ordering is reversed and after we fetched the results we invert the array. Sadly there is no easy implementation, since negative offsets are not a thing.

Source: https://medium.com/swlh/how-to-implement-cursor-pagination-like-a-pro-513140b65f32

Breaking changes:

  • renames orderAfter to cursor
  • adds cursorDirection with after by default

Copy link
Copy Markdown
Contributor

@kodumbeats kodumbeats left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Super small change, otherwise looks good 👍🏻

Comment thread src/Database/Adapter.php Outdated
Co-authored-by: kodumbeats <brandon.leckemby@gmail.com>
Comment thread src/Database/Adapter/MariaDB.php Outdated
Comment thread src/Database/Adapter/MariaDB.php Outdated
Comment thread src/Database/Database.php Outdated
Comment thread tests/Database/Base.php Outdated
@TorstenDittmann TorstenDittmann merged commit d93d1dd into main Oct 4, 2021
@TorstenDittmann TorstenDittmann deleted the before-pagination branch October 4, 2021 17:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants