chore(tools): centralize pagination cap helper
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user