Add pagination for query to get records #58

Merged
nabarun merged 8 commits from pm-add-pagination into main 2024-09-05 07:33:49 +00:00
Showing only changes of commit ef9129ecc0 - Show all commits

View File

@ -770,7 +770,7 @@ func paginate[T any](data []T, pagination *query.PageRequest) ([]T, *query.PageR
paginatedItems := data[start:end] paginatedItems := data[start:end]
if countTotal { if countTotal {
return paginatedItems, &query.PageResponse{Total: end - start} return paginatedItems, &query.PageResponse{Total: totalItems}
} else { } else {
return paginatedItems, nil return paginatedItems, nil
} }