docs: Enhanced the ParsePagination method documentation (#20385)

This commit is contained in:
Lucas Francisco López 2024-05-16 10:11:30 +02:00 committed by GitHub
parent f02a124667
commit 2c3fd19099
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -24,6 +24,11 @@ const DefaultLimit = 100
var PaginationMaxLimit uint64 = math.MaxUint64
// ParsePagination validate PageRequest and returns page number & limit.
// Note: cometBFT enforces a maximum query limit of 100 to avoid node overload.
// Queries above this limit will return the first 100 items.
// To retrieve subsequent pages, use an offset equal to the
// total number of results retrieved so far. For example, if you have retrieved 100 results and want to
// retrieve the next set of results, set the offset to 100 and the appropriate limit.
func ParsePagination(pageReq *PageRequest) (page, limit int, err error) {
offset := 0
limit = DefaultLimit