Skip to content

Commit

Permalink
Improve Keyset::Sequel and docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ddnexus committed Jul 18, 2024
1 parent ba645c2 commit 8442759
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions docs/api/keyset.md
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,12 @@ performance). You do it once during development, and pagy will be fast at each r
`next`,... : it's exactly the same as going backward like: `last`, `prev`, `prev`, ...
!!!

## How pagy keyset works

You pass an uniquely ordered `set`, and `Pagy::Keyset` queries the page of records, keeping track of the last retrieved record by
encoding it into the `page` param of the `next` URL. At each request the `:page` is decoded and used to prepare a `when` clause
that excludes the records retrived up to that point and pulls the `:limit` of requested records.

### ORMs

`Pagy::Keyset` implements the subclasses for `ActiveRecord::Relation` and `Sequel::Dataset` sets and instantiate them internally:
Expand All @@ -106,12 +112,6 @@ Pagy::Keyset.new(sequel_set)
#=> #<Pagy::Keyset::Sequel:0x00000001066545e0>
```

## How pagy keyset works

You pass an uniquely ordered `set`, and `Pagy::Keyset` queries the page of records, keeping track of the last retrieved record by
encoding it into the `page` param of the `next` URL. At each request the `:page` is decoded and used to prepare a `when` clause
that excludes the records retrived up to that point and pulls the `:limit` of requested records.

## Variables

=== `:page`
Expand Down

0 comments on commit 8442759

Please sign in to comment.