-
Notifications
You must be signed in to change notification settings - Fork 0
Open
Description
Background
When returning paginated results, one often wants to know "are there any more results after this page?" We do all the time in our closed source code. Consumers of the PaginatedResult<T> value object can use the Offset, Results.Count, and Total properties to deterministically calculate whether or not there are more results after the current page in the overall list of results. However, rather than require all consumers of this value object to implement this calculation themselves, let's provide it as a first class property.
Task
- Enhance
PaginatedResult<T>to throw exceptions on invalid input that prevent a deterministic calculation ofHasMore(null result set, negative total, result set + offset > total, etc.) - Enhance
PaginationResult<T>to include aHasMoreproperty that is calculated like so:
hasMore = (page.Offset + page.Results.Count) < page.Total;