validatePagination validates and caps pagination params.
(page, limit, maxLimit int)
| 21 | |
| 22 | // validatePagination validates and caps pagination params. |
| 23 | func 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 | |
| 36 | func dockerHostRowToHostInfo(r db.GetDockerHostsMinimalByIDsRow) *HostInfo { |
| 37 | return &HostInfo{ |
no outgoing calls
no test coverage detected