Skip to content

Develop#2

Merged
LeandroLCD merged 4 commits into
masterfrom
develop
Nov 18, 2025
Merged

Develop#2
LeandroLCD merged 4 commits into
masterfrom
develop

Conversation

@LeandroLCD

Copy link
Copy Markdown
Owner

No description provided.

…RE clause

This commit introduces a convenience feature where the first logical operation (`AND` or `OR`) is automatically used as the `WHERE` clause if one is not explicitly set in the query builder. This simplifies query construction by removing the requirement to call `where()` first.

The changes include:
- Modifying the `build()` method in `QuerySelect.Builder` and `QueryDelete.Builder` to automatically identify and set the `WHERE` clause from the existing logical operations.
- Updating `getSqlOperators()` in `QuerySelect`, `QueryDelete`, and `QueryUpdate` to correctly include the `where` operator in the returned list, improving query introspection.
This commit corrects a test case for `QueryDelete`.

The test `build without where clause throws exception` was incorrectly including a WHERE condition, which prevented it from accurately verifying that building a `QueryDelete` without any conditions throws an `IllegalArgumentException`. The extraneous condition has been removed.
@LeandroLCD

Copy link
Copy Markdown
Owner Author

merge pull

@LeandroLCD

Copy link
Copy Markdown
Owner Author

@copilot puedes revisar y aprobar este PR

Copilot AI commented Nov 17, 2025

Copy link
Copy Markdown

@LeandroLCD I've opened a new pull request, #3, to work on those changes. Once the pull request is ready, I'll request review from you.

Copilot AI 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.

Pull Request Overview

This PR modifies the query builder classes to change how WHERE clauses are handled and how SQL operators are collected. The main changes introduce a fallback mechanism that allows operations (AND/OR conditions) to be promoted to the WHERE clause when no explicit WHERE is set, and updates the getSqlOperators() method to include the WHERE clause in the returned list.

  • Modified getSqlOperators() in QueryDelete, QuerySelect, and QueryUpdate to include the WHERE clause in the returned list
  • Added fallback logic in QueryDelete and QuerySelect builders to automatically use the first operation as WHERE clause when none is explicitly set
  • Updated test to remove .and() call from the "build without where clause" test case

Reviewed Changes

Copilot reviewed 4 out of 4 changed files in this pull request and generated 4 comments.

File Description
query/src/main/java/com/blipblipcode/query/QueryDelete.kt Updated getSqlOperators() to include WHERE clause and added fallback logic in build() to use first operation as WHERE when not explicitly set
query/src/main/java/com/blipblipcode/query/QuerySelect.kt Updated getSqlOperators() to include WHERE clause and added fallback logic in build() to use first operation as WHERE when not explicitly set
query/src/main/java/com/blipblipcode/query/QueryUpdate.kt Changed getSqlOperators() to return the WHERE clause instead of an empty list
query/src/test/java/com/blipblipcode/query/QueryDeleteTest.kt Removed .and() call from test that validates exception is thrown when building without WHERE clause
Comments suppressed due to low confidence (1)

query/src/test/java/com/blipblipcode/query/QueryDeleteTest.kt:49

  • This test no longer validates that building without a WHERE clause throws an exception. The removal of the .and() call means the test now checks if building with an empty builder throws an exception, which is different from the original intent of ensuring a WHERE clause is required even when other operations are present. The test name suggests it should verify that a WHERE clause is required, but with the code changes in build() that allow falling back to operations, this test case may no longer be testing the right behavior. Consider updating the test to match the new behavior or reverting the behavior change in the build method.
    fun `build without where clause throws exception`() {
        val builder = QueryDelete.builder("users")

        assertThrows(IllegalArgumentException::class.java) {
            builder.build()
        }

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread query/src/main/java/com/blipblipcode/query/QuerySelect.kt Outdated
Comment thread query/src/main/java/com/blipblipcode/query/QueryDelete.kt Outdated
Comment thread query/src/main/java/com/blipblipcode/query/QuerySelect.kt Outdated
Comment thread query/src/main/java/com/blipblipcode/query/QueryDelete.kt Outdated
LeandroLCD and others added 2 commits November 17, 2025 20:59
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@LeandroLCD

Copy link
Copy Markdown
Owner Author

@copilot open a new pull request to apply changes based on the comments in this thread

Copilot AI commented Nov 18, 2025

Copy link
Copy Markdown

@LeandroLCD I've opened a new pull request, #4, to work on those changes. Once the pull request is ready, I'll request review from you.

@LeandroLCD
LeandroLCD merged commit 7c8d74f into master Nov 18, 2025
1 check passed
@github-actions github-actions Bot mentioned this pull request Jun 18, 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.

3 participants