Options
All
  • Public
  • Public/Protected
  • All
Menu

Class PagingParams

Data transfer object to pass paging parameters for queries.

The page is defined by two parameters:

  • the skip parameter defines number of items to skip.
  • the take parameter sets how many items to return in a page.
  • additionally, the optional total parameter tells to return total number of items in the query.

Remember: not all implementations support the total parameter because its generation may lead to severe performance implications.

Example

let filter = FilterParams.fromTuples("type", "Type1");
let paging = new PagingParams(0, 100);

myDataClient.getDataByFilter(filter, paging, (err, page) => {...});

Hierarchy

  • PagingParams

Index

Constructors

constructor

  • new PagingParams(skip?: any, take?: any, total?: any): PagingParams
  • Creates a new instance and sets its values.

    Parameters

    • Default value skip: any = null

      the number of items to skip.

    • Default value take: any = null

      the number of items to return.

    • Default value total: any = null

      true to return the total number of items.

    Returns PagingParams

Properties

skip

skip: number

The number of items to skip.

take

take: number

The number of items to return.

total

total: boolean

The flag to return the total number of items.

Methods

getSkip

  • getSkip(minSkip: number): number
  • Gets the number of items to skip.

    Parameters

    • minSkip: number

      the minimum number of items to skip.

    Returns number

    the number of items to skip.

getTake

  • getTake(maxTake: number): number
  • Gets the number of items to return in a page.

    Parameters

    • maxTake: number

      the maximum number of items to return.

    Returns number

    the number of items to return.

Static fromMap

  • Creates a new PagingParams and sets it parameters from the specified map

    Parameters

    • map: any

      a AnyValueMap or StringValueMap to initialize this PagingParams

    Returns PagingParams

    a newly created PagingParams.

Static fromTuples

  • Creates a new PagingParams from a list of key-value pairs called tuples.

    Parameters

    • Rest ...tuples: any[]

      a list of values where odd elements are keys and the following even elements are values

    Returns PagingParams

    a newly created PagingParams.

Static fromValue

  • Converts specified value into PagingParams.

    Parameters

    • value: any

      value to be converted

    Returns PagingParams

    a newly created PagingParams.

Generated using TypeDoc