Repository navigation
feat(166): refactored Query and Storage methods - #245
konekomind wants to merge 1 commit into
Conversation
Get - performance first, used in engine and critical infrastructure Find - queries to output data
Summary of ChangesHello @konekomind, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request introduces a significant refactoring of data access method names throughout the application. The primary goal is to enhance code clarity and maintainability by establishing a clear distinction between methods designed for direct, high-performance data retrieval ('Get') and those intended for more generalized querying, filtering, or pagination ('Find'). This change impacts various components, from core database query files to service interfaces and their implementations, ensuring a consistent and intuitive API for data interaction. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for Github and other Google products, sign up here. You can also get AI-powered code generation, chat, as well as code reviews directly in the IDE at no cost with the Gemini Code Assist IDE Extension. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request introduces a large-scale refactoring of query and storage method names to improve consistency, following the convention of using Get for performance-critical lookups and Find for general data queries. The changes are extensive and touch many files, including generated code from sqlc and protobufs.
While the refactoring is generally consistent, I've found a few areas that could be improved for better consistency and maintainability. Specifically, I've pointed out a duplicated SQL query, an inconsistent method name in a gRPC server implementation, and a query rename that seems to contradict the new naming convention.
Also, please be aware that renaming the GetFlowElementHistory RPC method to FindFlowElementHistory is a breaking change for clients of this gRPC service.
| }, err | ||
| } | ||
| flowElements, err := queries.GetFlowElementHistory(ctx, req.GetProcessInstanceKey()) | ||
| flowElements, err := queries.FindFlowElementHistory(ctx, req.GetProcessInstanceKey()) |
There was a problem hiding this comment.
The gRPC method for this functionality was renamed from GetFlowElementHistory to FindFlowElementHistory in the .proto file, which is a good change for consistency. However, the Go method on the server implementation is still named GetFlowElementHistory. For better maintainability and to avoid confusion, you should also rename this Go method to FindFlowElementHistory.
| -- name: GetIncidentsByProcessInstanceKey :many | ||
| SELECT | ||
| * | ||
| FROM | ||
| incident | ||
| WHERE | ||
| process_instance_key = @process_instance_key; |
There was a problem hiding this comment.
This adds a duplicated query GetIncidentsByProcessInstanceKey. The existing query FindIncidentsByProcessInstanceKey on line 26 has the same implementation. To maintain consistency and avoid duplication, you should remove this new query and rename FindIncidentsByProcessInstanceKey to GetIncidentsByProcessInstanceKey.
| LIMIT @size offset @offset; | ||
|
|
||
| -- name: FindWaitingJobs :many | ||
| -- name: GetWaitingJobs :many |
There was a problem hiding this comment.
The query FindWaitingJobs has been renamed to GetWaitingJobs. According to the convention described in the pull request ('Find - queries to output data'), this query should be named Find... as it performs a search with filters (key_skip, type) and a limit. Please consider renaming it back to FindWaitingJobs to adhere to the new naming convention.
-- name: FindWaitingJobs :many
Closes #166
Get - performance first, used in engine and critical infrastructure
Find - queries to output data