Skip to content

Commit

Permalink
FS-1266; Make pagination values public so i can access them from mctl (
Browse files Browse the repository at this point in the history
…#33)

* FS-1266; Make pagination values public so i can access them from mctl

* FS-1266; Fix lint issue
  • Loading branch information
jakeschuurmans authored Mar 21, 2024
1 parent 7215512 commit 18156cb
Showing 1 changed file with 8 additions and 8 deletions.
16 changes: 8 additions & 8 deletions pkg/api/v1/pagination.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ import (
)

var (
// maxPaginationSize represents the maximum number of records that can be returned per page
maxPaginationSize = 1000
// defaultPaginationSize represents the default number of records that are returned per page
defaultPaginationSize = 100
// MaxPaginationSize represents the maximum number of records that can be returned per page
MaxPaginationSize = 1000
// DefaultPaginationSize represents the default number of records that are returned per page
DefaultPaginationSize = 100
)

// PaginationParams allow you to paginate the results
Expand All @@ -34,7 +34,7 @@ type paginationData struct {

func parsePagination(c *gin.Context) PaginationParams {
// Initializing default
limit := defaultPaginationSize
limit := DefaultPaginationSize
page := 1
query := c.Request.URL.Query()

Expand Down Expand Up @@ -157,10 +157,10 @@ func (p *PaginationParams) limitUsed() int {
limit := p.Limit

switch {
case limit > maxPaginationSize:
limit = maxPaginationSize
case limit > MaxPaginationSize:
limit = MaxPaginationSize
case limit <= 0:
limit = defaultPaginationSize
limit = DefaultPaginationSize
}

return limit
Expand Down

0 comments on commit 18156cb

Please sign in to comment.