Exemplo n.º 1
0
    def _apply_simple_skiplimit_pagination(self, stmt: sa.sql.Select):
        """ Pagination for the SKIP/LIMIT mode: add SKIP/LIMIT clauses """
        if self.skip:
            stmt = stmt.offset(self.skip)
        if self.limit:
            stmt = stmt.limit(self.limit)

        # Done
        return stmt
Exemplo n.º 2
0
    def apply_to_statement(self, query: QueryObject, target_Model: SAModelOrAlias, stmt: sa.sql.Select) -> sa.sql.Select:
        # We will always load one more row to check if there's a next page
        skip = self.cursor_value.skip if self.cursor_value else 0
        limit = self.limit + 1 if self.limit is not None else None

        return stmt.offset(skip).limit(limit)