Katkat

Implement filters and cursor pagination

CoinbaseSoftware Engineer · Onsite

Last updated

This question evaluates a candidate's ability to design and implement cursor-based pagination, conjunctive per-field filtering, stable sort key selection, API surface design, and complexity analysis for a database-backed transaction query module.

Design and implement a transaction query module over a dataset or database where each transaction has startDate, endDate, userId, and amount. Requirements: (

  1. Provide per-field filters exposed via setter methods (e.g., setDateRange(start, end), setUserId(id), setAmountRange(min, max)); filters combine conjunctively. (
  2. Implement cursor-based pagination: given pageSize and an optional opaque cursor, return exactly pageSize matching transactions and a next cursor. Assume you can call a DB. Specify the stable sort keys used for pagination, define and encode the cursor, handle empty pages and end-of-results, address inserts/updates between requests, and provide code-level API signatures plus complexity analysis.