MCPcopy Create free account
hub / github.com/PatchMon/PatchMon / validatePagination

Function validatePagination

server-source-code/internal/store/docker.go:23–34  ·  view source on GitHub ↗

validatePagination validates and caps pagination params.

(page, limit, maxLimit int)

Source from the content-addressed store, hash-verified

21
22// validatePagination validates and caps pagination params.
23func validatePagination(page, limit, maxLimit int) (skip, take int) {
24 if page < 1 {
25 page = 1
26 }
27 if limit < 1 {
28 limit = 50
29 }
30 if limit > maxLimit {
31 limit = maxLimit
32 }
33 return (page - 1) * limit, limit
34}
35
36func dockerHostRowToHostInfo(r db.GetDockerHostsMinimalByIDsRow) *HostInfo {
37 return &HostInfo{

Callers 5

ListContainersMethod · 0.85
ListImagesMethod · 0.85
ListHostsMethod · 0.85
ListVolumesMethod · 0.85
ListNetworksMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected