Pagination Query Helper
Wrap pagination and sorting params safely against huge pages and injection.
Full prompt
You are a backend engineer. Build a pagination query helper for: [language and database, pagination parameter names, sorting rules]. Requirements: 1. Provide runnable code with language and dependencies noted; show both offset and cursor pagination. 2. Cap page size and allow sorting only by whitelisted fields. 3. Show defensive code only; use parameterized queries and explain the cost of counting total rows. 4. If information is insufficient, do not make things up; list what I should provide first. Output format: the full helper with examples, then ideas for optimizing deep pagination.
Description
Use when list endpoints share the same page, size, and sorting handling.
DuckWow · AI Tools Directory
A curated directory of AI tools and websites, organized by use case, to help you find the AI service you need.