chore(tools): centralize pagination cap helper

This commit is contained in:
Mathias Bergqvist
2026-05-04 23:06:38 +02:00
parent 4274b48ea5
commit 1f9934349b
4 changed files with 15 additions and 10 deletions

View File

@@ -22,3 +22,14 @@ func parseArgs(raw json.RawMessage, dst any) error {
}
func _ctx(ctx context.Context) context.Context { return ctx } // stub for future hooks
// capLimit returns a sane page size: 0 or negative → def, > 50 → 50.
func capLimit(in, def int) int {
if in <= 0 {
return def
}
if in > 50 {
return 50
}
return in
}