Skip to content

Missing Methods in Interfaces of go-mongox #82

@amirdaaee

Description

@amirdaaee

您使用的 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.

Metadata

Metadata

Assignees

Labels

enhancementNew feature or request

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions