Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Methods in Interfaces of go-mongox #82

Open
amirdaaee opened this issue Feb 17, 2025 · 4 comments
Open

Missing Methods in Interfaces of go-mongox #82

amirdaaee opened this issue Feb 17, 2025 · 4 comments
Assignees
Labels
enhancement New feature or request

Comments

@amirdaaee
Copy link

您使用的 mongox 版本 | The version of mongox you are using

version 2.2.1

当前实现缺陷 | Current Implementation Deficiencies

The go-mongox package provides interfaces for key struct types such as ICreator, IDeleter, IUpdater, and IFinder. These interfaces serve as powerful tools for unit testing, especially when used alongside the provided mock package. However, a major limitation exists: several methods available in the concrete implementations are not included in their respective interfaces.
Methods such as Filter(), Limit(), and potentially others are present in concrete structs of Finder, Deleter and ... but are missing in the corresponding interfaces.
This inconsistency prevents full utilization of the interfaces in unit tests, as crucial functionalities cannot be mocked or used interchangeably.

重构方案 | Refactoring Plan

To address these issues, the following refactoring steps are presented:

  1. Perform a detailed comparison between the concrete implementations (Creator, Deleter, Updater, Finder) and their respective interfaces (ICreator, IDeleter, IUpdater, IFinder).
  2. Add the missing methods (Filter(), Limit(), etc.) to their respective interfaces.
  3. Modify the provided mock package to support the newly added methods.
  4. Ensure all existing test cases function correctly with the updated mocks.
@chenmingyong0423
Copy link
Owner

@amirdaaee Thanks a lot for your great feedback! I completely agree with your point and will refactor the code to address the mock issue while keeping the existing functionality intact.

@chenmingyong0423 chenmingyong0423 added the enhancement New feature or request label Feb 17, 2025
@chenmingyong0423
Copy link
Owner

@amirdaaee If you're interested in taking on this refactor, just leave a comment here, and I'd be happy to assign it to you!

@amirdaaee
Copy link
Author

hell yes, i'll do that (probably in 5-10 days span considering my real life work load!)

@chenmingyong0423
Copy link
Owner

Just take your time, and if you have any questions or need help along the way, feel free to discuss anytime.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants