You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
您使用的 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.
The text was updated successfully, but these errors were encountered:
@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.
您使用的 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 asICreator
,IDeleter
,IUpdater
, andIFinder
. 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 ofFinder
,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:
Creator
,Deleter
,Updater
,Finder
) and their respective interfaces (ICreator
,IDeleter
,IUpdater
,IFinder
).Filter()
,Limit()
, etc.) to their respective interfaces.The text was updated successfully, but these errors were encountered: