| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
Sorry, something went wrong.
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! |
Sorry, something went wrong.
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
| Back | FazBrowse Home | New Git URL |
Pull request for 1.0.5
So far:
Github Pages Markdown Documentation
Integrate QueryBuilderDefaults into all SELECT/DELETE builders
QueryBuilder, DeleteBuilder, and SelectBuilder each gain:
at construction time (snapshot semantics, not live).
override without touching the global.
Behavioural changes when a non-default QueryBuilderDefaults is active:
configured dialect instead of hardcoded SqlDialect.STANDARD.
and the defaults carry a non-negative value (explicit wins).
likeSuffix (previously had no wrapping at all, aligned with
AbstractSqlDialect behaviour).