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
BREAKING CHANGE:
- Removed `cursorableColumns` from `PaginateConfig` in favor of using `sortableColumns` exclusively.
- `PaginateQuery` no longer accepts `cursorColumn` or `cursorDirection`; direction is now inferred from `sortBy`.
- Removed `firstCursor` and `lastCursor` from `Paginated.meta`; only `cursor` is retained.
- Navigation links now rely on the new composite cursor format and dynamic sort direction.
* Note: CURSOR requires `cursorableColumns` to be defined.
333
319
*
334
320
* However, using limit/offset can cause problems with relations.
335
321
*/
@@ -574,6 +560,38 @@ is resolved to:
574
560
575
561
`WHERE ... AND (id = 5 OR id = 7) AND name = 'Milo' AND ...`
576
562
563
+
## Cursor-based Pagination
564
+
565
+
-`paginationType: PaginationType.CURSOR`
566
+
- Cursor format:
567
+
- Numbers: `[prefix1][integer:11 digits][prefix2][decimal:4 digits]` (e.g., `Y00000000001V2500` for -1.25 in ASC).
568
+
- Dates: `[prefix][value:15 digits]` (e.g., `V001671444000000` for a timestamp in DESC).
569
+
- Prefixes:
570
+
-`null`: `A` (lowest priority, last in results).
571
+
- ASC:
572
+
- positive-int: `V` (greater than or equal to 1), `X` (less than 1)
573
+
- positive-decimal: `V` (not zero), `X` (zero)
574
+
- zero-int: `X`
575
+
- zero-decimal: `X`
576
+
- negative-int: `Y`
577
+
- negative-decimal: `V`
578
+
- DESC:
579
+
- positive-int: `V`
580
+
- positive-decimal: `V`
581
+
- zero-int: `N`
582
+
- zero-decimal: `X`
583
+
- negative-int: `M` (less than or equal to -1), `N` (greater than -1)
584
+
- negative-decimal: `V` (not zero), `X` (zero)
585
+
- Logic:
586
+
- Numbers: Split into integer (11 digits) and decimal (4 digits) parts, with separate prefixes. Supports negative values, with sorting adjusted per direction.
587
+
- Dates: Single prefix with 15-digit timestamp padded with zeros.
588
+
- ASC: Negative → Zero → Positive → Null.
589
+
- DESC: Positive → Zero → Negative → Null.
590
+
- Notes:
591
+
- Multiple columns: `sortBy` can include multiple columns to create and sort by the cursor (e.g., `sortBy=age:ASC,createdAt:DESC`), but at least one column must be unique to ensure consistent ordering.
592
+
- Supported columns: Cursor sorting is available for numeric and date-related columns (string columns are not supported).
593
+
- Decimal support: Numeric columns can include decimals, limited to 11 digits for the integer part and 4 digits for the decimal part.
594
+
577
595
## Swagger
578
596
579
597
You can use two default decorators @ApiOkResponsePaginated and @ApiPagination to generate swagger documentation for your endpoints
0 commit comments