-
Notifications
You must be signed in to change notification settings - Fork 13
Description
您使用的 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:
- Perform a detailed comparison between the concrete implementations (
Creator,Deleter,Updater,Finder) and their respective interfaces (ICreator,IDeleter,IUpdater,IFinder). - Add the missing methods (
Filter(),Limit(), etc.) to their respective interfaces. - Modify the provided mock package to support the newly added methods.
- Ensure all existing test cases function correctly with the updated mocks.