Skip to content

Replace store.WithContext with normal ctx param #90

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

Merged
merged 1 commit into from
Jun 5, 2025
Merged

Conversation

jemiahw
Copy link
Collaborator

@jemiahw jemiahw commented 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.

@jemiahw jemiahw requested a review from Copilot June 4, 2025 00:18
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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
daniel-nichter previously approved these changes Jun 4, 2025
qian-squareup
qian-squareup previously approved these changes Jun 4, 2025
wen-hui-sun
wen-hui-sun previously approved these changes Jun 4, 2025
@jemiahw jemiahw force-pushed the jemiah/storectx branch from df3c0ab to d94948e Compare June 4, 2025 18:25
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.
@jemiahw jemiahw merged commit dd90904 into master Jun 5, 2025
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants