An open API service indexing awesome lists of open source software.

https://github.com/dmitryfillo/noffset


https://github.com/dmitryfillo/noffset

Last synced: over 1 year ago
JSON representation

Awesome Lists containing this project

README

          

noffset
=======

**OBSOLETED! Not supported, just history.**

Summary
-------

Fast pagination for sql-like databases. **Does not use offset!** `See presentation `_.

Supports: SQLAlchemy.

Explanatory example
--------------

.. code-block:: python

import noffset.sqla.pagination as pagination

#### `cursor`, `direction`, `reverse` are optional. If these are not defined func will return param for first page.

to_template = pagination(sqla_db_object, db_model_class, perpage_items_num, cursor, direction, reverse)

*to_template* is **dict(data, cursor_next, cursor_prev, pages_total)** now.

.. code-block:: html

data: {{ to_template['data'] }}
next button: next
prev button: prev

What about *reverse* param? If False last item in DB will be first (like newspapers, comments, etc). If True last item in DB will be honestly last.

Simply. Also see the source code.