Skip to content

feat(166): refactored Query and Storage methods - #245

Closed
konekomind wants to merge 1 commit into
mainfrom
feature/166-Update-storage-and-query-methods
Closed

konekomind wants to merge 1 commit into
mainfrom
feature/166-Update-storage-and-query-methods

Conversation

@konekomind

Copy link
Copy Markdown
Contributor

Closes #166
Get - performance first, used in engine and critical infrastructure
Find - queries to output data

Get - performance first, used in engine and critical infrastructure
Find - queries to output data
@gemini-code-assist

Copy link
Copy Markdown
Contributor

Summary of Changes

Hello @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

  • Method Naming Refactoring: Database query methods have been refactored to distinguish between 'Get' and 'Find' operations. 'Get' methods are now used for direct, key-based lookups, typically for performance-critical internal use, while 'Find' methods are for queries that may involve filtering, pagination, or return multiple results.
  • Consistency Across Layers: This naming convention update has been applied consistently across the persistence layer, including internal/cluster/node.go, internal/cluster/partition/partition_persistence.go, internal/sql/*.go files, and the pkg/bpmn and pkg/dmn engine components, as well as the pkg/storage interfaces and in-memory implementation.
  • Protobuf and gRPC Updates: The GetFlowElementHistory method in the protobuf service definition and gRPC method names has been renamed to FindFlowElementHistory to align with the new naming convention, indicating it's a retrieval operation that might involve more than a direct key lookup.
Using Gemini Code Assist

The 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 /gemini <command> or @gemini-code-assist <command>. Below is a summary of the supported commands on the current page.

Feature Command Description
Code Review /gemini review Performs a code review for the current pull request in its current state.
Pull Request Summary /gemini summary Provides a summary of the current pull request in its current state.
Comment @gemini-code-assist Responds in comments when explicitly tagged, both in pull request comments and review comments.
Help /gemini help Displays a list of available commands.

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 .gemini/ folder in the base of the repository. Detailed instructions can be found here.

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

  1. Review the Privacy Notices, Generative AI Prohibited Use Policy, Terms of Service, and learn how to configure Gemini Code Assist in GitHub here. Gemini can make mistakes, so double check it and use code with caution. ↩

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

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())

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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.

Comment on lines +33 to +39
-- name: GetIncidentsByProcessInstanceKey :many
SELECT
*
FROM
incident
WHERE
process_instance_key = @process_instance_key;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

medium

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

@konekomind konekomind closed this Feb 11, 2026
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.

Update storage and query methods

1 participant