Skip to content

Conversation

sathvik-palley
Copy link
Collaborator

Description
Created a shared pagination utility to eliminate code duplication across database files in datapup. Previously, multiple database files contained identical pagination logic, leading to redundant code. This refactoring centralizes the pagination functionality into a reusable utility that can be imported and used across different database implementations.

Type of Change
Please mark the relevant option(s):
✨ New feature (non-breaking change which adds functionality)
♻️ Code refactoring

Related Issues
Fixes #99

Testing
Please confirm the following:
I have tested these changes locally

Additional Notes
The new pagination.ts utility maintains the same interface and behavior as the previous inline implementations
No breaking changes - all existing pagination functionality should work exactly as before

@@ -0,0 +1,75 @@
import { TableQueryOptions, TableFilter, QueryResult } from '../database/interface'

export interface DatabaseAdapter {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we need this? If yes, can we add this near BaseDatabaseManager as interface IBaseDatabaseManager?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, we need it - it defines the contract for the pagination utility to work with different database implementations. I would keep it here rather than near BaseDatabaseManager since it's pagination-specific.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Enhancement: Refactor Duplicate Pagination Code.

2 participants