UNPKG

pip-services3-commons-nodex

Version:

Portable abstractions and patterns for Pip.Services in Node.js / ES2017

45 lines 1.81 kB
"use strict"; /** @module data */ Object.defineProperty(exports, "__esModule", { value: true }); exports.TokenizedDataPage = void 0; /** * Data transfer object that is used to pass results of paginated queries. * It contains items of retrieved page and optional total number of items. * * Most often this object type is used to send responses to paginated queries. * Pagination parameters are defined by [[TokenizedPagingParams]] object. * The <code>token</code> parameter in the TokenizedPagingParams there means where to start the searxh. * The <code>takes</code> parameter sets number of items to return in the page. * And the optional <code>total</code> parameter tells to return total number of items in the query. * * The data page returns a token that shall be passed to the next search as a starting point. * * Remember: not all implementations support the <code>total</code> parameter * because its generation may lead to severe performance implications. * * @see [[PagingParams]] * * ### Example ### * * page := await myDataClient.getDataByFilter( * "123", * FilterParams.fromTuples("completed": true), * new TokenizedPagingParams(null, 100, true) * ); */ class TokenizedDataPage { /** * Creates a new instance of data page and assigns its values. * * @param data a list of items from the retrieved page. * @param token (optional) a token to define astarting point for the next search. * @param total (optional) a total number of objects in the result. */ constructor(data = null, token = null, total = null) { this.total = total; this.token = token; this.data = data; } } exports.TokenizedDataPage = TokenizedDataPage; //# sourceMappingURL=TokenizedDataPage.js.map