Skip to content

Conversation

@LeandroLCD
Copy link
Owner

No description provided.

This commit enhances the `Queryable` interface to allow for inspection of the query's internal components. This refactoring improves introspection capabilities, making it easier to analyze and manipulate query structures programmatically.

The changes include:
- Adding `getSqlOperators()`, `getTableName()`, and `getSqlOperation(key: String)` to the `Queryable` interface.
- Implementing these new methods in `QuerySelect`, `QueryDelete`, `QueryUpdate`, `QueryInsert`, `UnionQuery`, and `InnerJoint`.
- Moving the `LogicalType` enum to its own file (`operator/LogicalType.kt`) for better organization.
- Converting `LogicalOperation` to a data class to provide `equals`, `hashCode`, and `toString` implementations automatically.
This commit introduces the `LIMIT` clause functionality to `QuerySelect`, allowing for pagination and limiting the number of results in a query.

The main changes include:
- A new `Limit` data class to represent the `LIMIT` and optional `OFFSET` values.
- Integration of the `Limit` operator into `QuerySelect` and its `QueryBuilder`.
- New `limit()` methods in both `QuerySelect` and `QueryBuilder` to set the limit and offset.
- Updates to the SQL generation in `asSql()` to append the `LIMIT ... OFFSET ...` string.

Additionally, comprehensive unit tests have been added in `QuerySelectTest` to verify the correct behavior of the `LIMIT` clause with and without an offset, including edge cases like zero and negative values.
@LeandroLCD LeandroLCD merged commit e9765c7 into master Oct 29, 2025
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.

2 participants