@tusss/ood
    Preparing search index...

    Class PaginationResult

    Represents the result of a paginated query, detailing metadata about pages and total counts.

    Creating a pagination result from standard pagination and total count

    const pagination = new Pagination({ page: 2, perPage: 10 });
    const result = new PaginationResult(pagination, 25);

    console.log(result.totalPages); // 3
    console.log(result.nextPage); // 3
    console.log(result.prevPage); // 1

    Hierarchy (View Summary)

    Implements

    Index

    Constructors

    Properties

    nextPage?: number

    The page index for the next page, or undefined if on the last page.

    page: number

    The 1-based index of the current page.

    perPage: number

    The maximum number of items per page.

    prevPage?: number

    The page index for the previous page, or undefined if on the first page.

    total: number

    The total number of items matching the query.

    totalPages: number

    The total number of pages calculated from total and perPage.

    Methods

    • Implements the JSON.stringify() behavior.

      It uses toStruct to get the plain object structure under the hood.

      It is encouraged to use toStruct instead of this method because it provides better clarity and expressiveness about the data structure being serialized. This method is provided only to support the JSON.stringify() serialization.

      Returns ClassProperties<TData>

      A plain object structure containing the model's serializable properties.