Merged
Conversation
docs: added public Markdown documentation through Github Pages
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
ci: fix workflows
fix: bump version to 1.0.5
Immutable config holder with JVM-wide global (volatile static) and per-instance override support (builder.withDefaults(...)). Configures: - SQL dialect (default: STANDARD) - Default SELECT column expression (default: "*") - Default LIMIT / OFFSET (default: -1, i.e. none) - LIKE prefix / suffix (default: "%" / "%") Global is captured at builder construction time so behaviour is predictable across concurrent updates.
Three new fields propagated from QueryBuilderDefaults into the Query
data object at build() time so dialect-agnostic renderers can read them:
- defaultSelectColumns (fallback when selectColumns is empty)
- likePrefix (prepended to LIKE / NOT LIKE values)
- likeSuffix (appended to LIKE / NOT LIKE values)
All fields default to the existing hardcoded behaviour ("*", "%", "%")
so there is no change to query output without an explicit configuration.
AbstractSqlDialect now reads from the Query object instead of using hardcoded literals: - appendSelectColumns: uses query.getDefaultSelectColumns() instead of "*" - LIKE / NOT LIKE params: uses query.getLikePrefix()/getLikeSuffix() instead of hardcoded "%" + val + "%" appendConditionFragment gains a Query parameter to pass the hints through to appendNonComparisonFragment.
QueryBuilder, DeleteBuilder, and SelectBuilder each gain: - A queryBuilderDefaults field initialised from QueryBuilderDefaults.global() at construction time (snapshot semantics — not live). - A withDefaults(QueryBuilderDefaults) fluent method for per-instance override without touching the global. Behavioural changes when a non-default QueryBuilderDefaults is active: - Dialect: buildSql() / build() null-fallback now routes to the configured dialect instead of hardcoded SqlDialect.STANDARD. - Default columns: rendered when no explicit select() columns are set. - Default limit / offset: applied when builder sentinel (-1) is present and the defaults carry a non-negative value (explicit wins). - LIKE wrapping: SelectBuilder.whereLike() now honours likePrefix / likeSuffix (previously had no wrapping at all — aligned with AbstractSqlDialect behaviour).
…ping
QueryBuilderDefaultsTest (23 tests) covers:
- Canonical global defaults (STANDARD, "*", -1, -1, "%", "%")
- builder() and builder(source) factory methods
- setGlobal(null) NPE guard
- withDefaults(null) NPE guard on all three builders
- Global dialect applied to newly created QueryBuilder
- Per-instance withDefaults() overrides global for that instance only
- Explicit buildSql(table, dialect) parameter wins over configured default
- defaultColumns / explicit select() winner semantics
- defaultLimit / defaultOffset applied and overridden correctly
- Custom likePrefix / likeSuffix applied (QueryBuilder + SelectBuilder)
- DeleteBuilder dialect routing via withDefaults()
- SelectBuilder defaultColumns, defaultLimit, LIKE wrapping
SelectBuilderTest.testWhereLike: updated to pass the raw value ("bob")
instead of pre-wrapped "%bob%" now that SelectBuilder auto-wraps using
the configured likePrefix/likeSuffix (consistent with QueryBuilder).
Defaults Configuration
Cover the five NullPointerException guards in QueryBuilderDefaults that were previously unreachable in tests: - builder(null) on the static factory - Builder.dialect(null) - Builder.defaultColumns(null) - Builder.likePrefix(null) - Builder.likeSuffix(null) Also add selectBuilderDefaultOffsetApplied to hit the true-branch of the defaultOffset ternary in SelectBuilder.buildLimitOffsetClause(). QueryBuilderDefaults now reports 100% line coverage; SelectBuilder reaches 97.7% (only the unreachable UnsupportedOperationException path for unknown operators remains uncovered).
test: add null-guard and SelectBuilder offset tests for full coverage
docs: improved readability
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull request for
1.0.5So far:
Github Pages Markdown Documentation
docs/folderIntegrate QueryBuilderDefaults into all
SELECT/DELETEbuildersQueryBuilder, DeleteBuilder, and SelectBuilder each gain:
queryBuilderDefaultsfield initialised fromQueryBuilderDefaults.global()at construction time (snapshot semantics, not live).
withDefaults(QueryBuilderDefaults)fluent method for per-instanceoverride without touching the global.
Behavioural changes when a non-default QueryBuilderDefaults is active:
buildSql()/build()null-fallback now routes to theconfigured dialect instead of hardcoded
SqlDialect.STANDARD.select()columns are set.and the defaults carry a non-negative value (explicit wins).
SelectBuilder.whereLike()now honourslikePrefix/likeSuffix(previously had no wrapping at all, aligned withAbstractSqlDialect behaviour).