Skip to main content
IlanaORM ships three pagination strategies. Pick the right one for your use case.

paginate — Full Pagination

Returns a total count and page metadata. Use when you need page numbers or a “Page 3 of 47” UI.
Response shape:
When to use: Admin dashboards, search results, anywhere the user needs to jump to a specific page. Trade-off: Runs a COUNT(*) query on every request — can be slow on large tables.

simplePaginate — Next/Prev Only

No total count. Just tells you whether there’s a next page. Use for “Load more” or “Next / Previous” navigation.
Response shape:
When to use: Mobile apps, infinite scroll, APIs where total count isn’t needed. Trade-off: Can’t tell the user “Page 3 of 47” — only “there are more results.”

cursorPaginate — Cursor-Based Pagination

Paginates using a cursor value (usually a column like id or created_at) instead of page offsets. Consistent even when rows are inserted or deleted between requests.
Response shape:
Pass the cursor on the next request:
When to use: Real-time feeds, large datasets, APIs where rows can be inserted mid-session. Trade-off: Can’t jump to page 47 — only forward/backward.

Comparison


With Filters and Scopes

All three methods work with any query: