Repository navigation
refactor(chat): push pagination down to ListByOwnerIDs - #20450
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (4)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughOwner-ID chat listing now accepts pagination in the DAO. The DAO counts matching rows and applies SQL offset and limit when both pagination values are positive. The service passes pagination parameters through instead of slicing returned rows. Tests cover page boundaries, totals, unpaginated results, and joined owner fields. ChangesOwner-ID Chat Pagination
Priority: ➖ Normal Estimated code review effort: 3 (Moderate) | ~20 minutes Change: Refactor Suggested reviewers: Merge Risk: ⚪ Minimal · up to Owner-ID chat pagination now runs in the database while preserving totals and returned fields. No actionable merge-blocking risk is identified; merge after normal checks pass. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. A rabbit counts the rows in line Comment |
infiniflow#20450 moved pagination for the owner_ids branch into ListByOwnerIDs, so the DAO now takes page and pageSize and the service no longer slices the rows itself. This branch adds exact id and name filters to the same function, so the two signatures conflicted. ListByOwnerIDs keeps both: page and pageSize from infiniflow#20450, then keywords, id and name. The id and name predicates are applied before the COUNT, so the total infiniflow#20450 reports still follows the filtered rows. The service call passes both. Both sides added tests to internal/dao/chat_test.go and internal/service/chat_list_test.go, and all of them are kept. The new pagination tests from infiniflow#20450 pass empty id and name, and the exact filter tests from this branch pass page 1 and size 10 to the owner branch. No assertion changed on either side. internal/dao 267, internal/service 1195 and internal/handler 585 tests pass with no failures, including the four tests the two sides added. go vet and gofmt are clean.
Summary
This PR pushes pagination down to the DAO layer. Replaces in-memory counting with database-level COUNT and LIMIT/OFFSET, reducing memory usage and improving performance on large datasets. Verified via unit tests and manual pagination checks.