1
0
mirror of https://github.com/rancher/norman.git synced 2025-09-14 22:33:43 +00:00

Add no pagination option

There is now a recognized option for opting out of pagination.
Prior, passing a limit of -1 would set the pagination limit to
the default, 1000. Now, a value of -1 will set the pagination
limit to the max, likely resulting in a non paginated response.
This commit is contained in:
rmweir
2019-04-05 10:22:04 -07:00
committed by Craig Jellick
parent d499db2294
commit 9836657574

View File

@@ -10,7 +10,7 @@ import (
var ( var (
defaultLimit = int64(1000) defaultLimit = int64(1000)
maxLimit = int64(3000) maxLimit = int64(10000)
) )
func QueryOptions(apiContext *types.APIContext, schema *types.Schema) types.QueryOptions { func QueryOptions(apiContext *types.APIContext, schema *types.Schema) types.QueryOptions {
@@ -67,7 +67,7 @@ func parsePagination(apiContext *types.APIContext) *types.Pagination {
return result return result
} }
if limitInt > maxLimit { if limitInt > maxLimit || limitInt == -1 {
result.Limit = &maxLimit result.Limit = &maxLimit
} else if limitInt >= 0 { } else if limitInt >= 0 {
result.Limit = &limitInt result.Limit = &limitInt