Replace store.WithContext with normal ctx param#90
Merged
Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR refactors the entity store API to remove the custom WithContext method and instead pass context as the first argument in all relevant methods.
- Replaces WithContext and its associated functionality in the entity store and its mocks.
- Updates all related tests and API endpoints to use the standard context parameter.
- Adjusts error handling and CDC write functions accordingly.
Reviewed Changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
| test/mock/entity.go | Removed WithContextFunc field and updated function signatures. |
| entity/v09_test.go | Updated test calls to pass context.Background() to store methods. |
| entity/store_test.go | Modified test calls to pass context.Background() in store method calls. |
| entity/store.go | Refactored store implementation to remove WithContext and pass context param. |
| api/single_entity_write_test.go | Updated mock functions to accept context parameter. |
| api/single_entity_read_test.go | Updated mock functions to accept context parameter. |
| api/query_test.go | Revised ReadEntitiesFunc in mocks to accept context parameter. |
| api/bulk_write_test.go | Updated mock functions to accept context parameter. |
| api/api_test.go | Removed WithContext usage and updated context propagation in tests. |
| api/api_gomux.go | Replaced WithContext calls with direct context parameter passing. |
Comments suppressed due to low confidence (1)
entity/store.go:51
- Update the function documentation to describe the purpose of the new 'ctx' parameter and its usage, ensuring consistency with the updated method signature.
func (s store) ReadEntities(ctx context.Context, entityType string, q query.Query, f etre.QueryFilter) ([]etre.Entity, error) {
daniel-nichter
previously approved these changes
Jun 4, 2025
qian-squareup
previously approved these changes
Jun 4, 2025
wen-hui-sun
previously approved these changes
Jun 4, 2025
Previously the entity store had a WithContext(ctx) method to pass in the context. This PR replaces that with the standard pattern passing context in as the first argument to the methods.
b0ba800
wen-hui-sun
approved these changes
Jun 4, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously the entity store had a WithContext(ctx) method to pass in the context. This PR replaces that with the standard pattern passing context in as the first argument to the methods.