Skip to content

DmitryFillo/noffset

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 

Repository files navigation

noffset

OBSOLETED! Not supported, just history.

Summary

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

Supports: SQLAlchemy.

Explanatory example

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.

data: {{ to_template['data'] }}
next button: <a href=".../?cursor={{ to_template['cursor_next'] }}&direction=True">next</a>
prev button: <a href=".../?cursor={{ to_template['cursor_prev'] }}&direction=False">prev</a>

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.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages