You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/api/keyset.md
+5-6Lines changed: 5 additions & 6 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,7 +41,7 @@ less convenient for UIs.
41
41
|`uniquely ordered`| When the concatenation of the values of the ordered columns is unique for each record. It is similar to a composite primary `key` for the ordered table, but dynamically based on the `keyset` columns. |
42
42
|`set`| The `uniquely ordered``ActiveRecord::Relation` or `Sequel::Dataset` collection to paginate. |
43
43
|`keyset`| The hash of column/direction pairs. Pagy extracts it from the order of the `set`. |
44
-
|`latest`| The hash of `keyset` attributes of the `latest` fetched record (from the latest page). Pagy decodes it from the `:page` variable, and uses it to filter out the records already fetched. |
44
+
|`latest`| The hash of `keyset` attributes of the `latest` fetched record (from the latest page). Pagy decodes it from the `:page` variable and uses it to filter out the records already fetched.|
45
45
|`next`| The next `page`, i.e. the encoded reference to the last record of the **current page**. |
46
46
|`page`| The current `page`, i.e. the encoded reference to the `latest` record of the **latest page**. |
47
47
@@ -162,10 +162,9 @@ automatically assigned from the `limit` request param.
162
162
163
163
=== `:tuple_comparison`
164
164
165
-
Boolean variable that enables the tuple comparison e.g. `(brand, id) > (:brand, :id)`. It works only for same direction order,
166
-
hence it's ignored for mixed order. Check how your DB supports it (your `keyset` should include only `NOT NULL` columns).
167
-
Default
168
-
`nil`.
165
+
Boolean variable that enables the tuple comparison e.g. `(brand, id) > (:brand, :id)`. It works only with the same direction
166
+
order, hence it's ignored for mixed order. Check how your DB supports it (your `keyset` should include only `NOT NULL` columns).
167
+
Default `nil`.
169
168
170
169
==- `:after_latest`
171
170
@@ -242,7 +241,7 @@ They may have been stored as strings formatted differently than the default form
242
241
- Ensure that the composite index reflects exactly the columns sequence and order of your keyset
243
242
- Research about your specific DB features, type of index and performance for different ordering. Use SQL `EXPLAIN ANALYZE`
244
243
or similar tool to confirm.
245
-
- Consider using the same direction order, enabling the `:tuple_comparison`, changing type of index (different DBs may behave
244
+
- Consider using the same direction order, enabling the `:tuple_comparison`, and changing type of index (different DBs may behave
246
245
differently)
247
246
- Consider using your custom optimized `when` query with the [:after_latest](#after-latest) variable
0 commit comments