Skip to content

Replace dynamic builders with typed immutable state - #2

Merged
strider2038 merged 3 commits into
mainfrom
typed-builder-evaluation
Oct 2, 2026
Merged

strider2038 merged 3 commits into
mainfrom
typed-builder-evaluation

Conversation

@strider2038

Copy link
Copy Markdown
Contributor

Replace reflection-based lann/builder state with private typed immutable state across SELECT, INSERT, UPDATE, DELETE, CASE, CTE, and statement builders. Persistent typed lists keep branching independent and avoid quadratic copying in long query chains. The root module now has no external dependencies; SQL rendering and final-pass placeholder numbering are retained.

Compatibility requires review before merging:

  • Public method signatures remain unchanged, but conversions between concrete builders or to/from lann/builder.Builder, and external builder.Set/GetStruct calls, are no longer supported.
  • Builder values remain comparable; equality represents state identity and no-op equality can differ.
  • WHERE defaults on statement seeds now apply only to SELECT/UPDATE/DELETE. INSERT and CTE ignore these defaults instead of panicking on an unknown reflected field.

Adds a differential harness against published v0.1.0, concurrent branch/render regression tests, reproducible benchmarks, and CI checks. Representative construction-plus-rendering benchmarks use 53–65% fewer allocations (SELECT: 58 → 23); shared-host timing measurements improved in all measured scenarios but are not production performance guarantees.

Validation:

  • Full scripts/test-all.sh passed on Go 1.26.2 with real PostgreSQL 18.1, including lint, unit/race, fuzz, differential comparison, dependency policy, module tidy, API inventory, compatibility, and integration checks.
  • Go 1.25.14 and Go 1.26.2 additionally passed unit/race, vet, differential, compatibility, fuzz, and PostgreSQL 14.24 integration checks.
  • Migration notes, changelog, API inventory, and benchmark evidence are updated.

See implementation report for raw benchmark links, compatibility details, and the remaining maintainer adoption decision. This PR is the separate post-v0.1.0 replacement stream; it does not publish a release.

@strider2038
strider2038 merged commit 1185d6e into main Oct 2, 2026
2 checks passed
@strider2038
strider2038 deleted the typed-builder-evaluation branch October 2, 2026 10:34
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.

1 participant