Skip to content

Commit cfc6c1c

Browse files
authored
fix(defaults): removing embedded fs for bazel (#41)
removing embedded fs
1 parent 79db4c2 commit cfc6c1c

File tree

3 files changed

+10
-111
lines changed

3 files changed

+10
-111
lines changed

defaults.go

Lines changed: 0 additions & 77 deletions
This file was deleted.

defaults_test.go

Lines changed: 0 additions & 22 deletions
This file was deleted.

paginator_details.go

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -51,23 +51,21 @@ func DetailsFromRequest(req *http.Request) (*PaginatorDetails, error) {
5151
}
5252

5353
func getLimit(q url.Values) (int, error) {
54-
limit := limitDefault()
54+
limit := queryLimitDefault
5555
limitStr := q.Get(QueryLimit)
5656
if limitStr == "" {
5757
return limit, nil
5858
}
59-
limit, err := strconv.Atoi(limitStr)
59+
var err error
60+
limit, err = strconv.Atoi(limitStr)
6061
if err != nil {
6162
return 0, fmt.Errorf("invalid limit: %w", err)
6263
}
63-
if limit < limitMin() {
64-
limit = limitMin()
64+
if limit > queryLimitMax {
65+
return queryLimitMax, nil
6566
}
66-
if limit > limitMax() {
67-
limit = limitMax()
68-
}
69-
if limit <= 0 {
70-
limit = limitDefault()
67+
if limit < queryLimitMin {
68+
return queryLimitMin, nil
7169
}
7270
return limit, nil
7371
}
@@ -114,10 +112,10 @@ func GetPaginatorDetails(
114112
d.SortDir = string(*sortDir)
115113
}
116114
if d.Limit <= 0 {
117-
d.Limit = limitDefault()
115+
d.Limit = queryLimitDefault
118116
}
119-
if d.Limit > limitMax() {
120-
d.Limit = limitMax()
117+
if d.Limit > queryLimitMax {
118+
d.Limit = queryLimitMax
121119
}
122120
return d
123121
}

0 commit comments

Comments
 (0)