Active Context: sqlh
June 12, 2026 · View on GitHub
Current State
The project is at version v0.8.0 on main. The v0.8.0 annotated tag has been
created. GitHub release notes are pending and will be published after this PR
is merged. No active development branches are in flight.
Recent Changes (v0.8.0 — 2026-06-12)
Type-safe WHERE Helpers (issue #14)
- Added:
sqlh.Eq,sqlh.Ne,sqlh.Gt,sqlh.Gte,sqlh.Lt,sqlh.Lte,sqlh.Like,sqlh.In,sqlh.IsNull,sqlh.IsNotNull— fluent helpers for building WHERE conditions without raw SQL strings. - Fixed: Backward compatibility restored for exported
query.Updateandquery.Deletewrappers. Fixed missing space before?inprocessWhere.
Documentation & Examples (issues #25, #26, #27, #28, #29)
- Animated GIF demo:
docs/demo.gif+examples/demo/for README. (#25) - Code comparison:
examples/comparison/side-by-side raw sql / sqlx / sqlh. (#26) - pkg.go.dev badge: Official Go Reference badge replacing deprecated godoc.org. (#27)
- Benchmarks: 24 benchmark functions in
bench/vs raw sql, sqlx, GORM. (#28) - Table[T] examples:
Example_functions insqlh_example_test.gofor pkg.go.dev. (#29)
Schema Migrations (issue #47, PR #48)
- Added:
sqlh/migratesub-package —FromStruct[T],Diff[T],Raw,Apply,DryRun,AutoAdd(),Backuphook. - Architecture:
querierinterface unifying*sql.DBand*sql.Txfor safe introspection inside transactions.Versionas integer (ascending order). - Safety:
AutoAdd()generates onlyADD COLUMN; destructive changes require explicitmigrate.Raw(). Full transaction wrapping with rollback on failure. - Testing: 18 integration tests, all passing. Zero new dependencies.
Prior Releases
v0.7.1 — 2026-06-11
- Native UPSERT: PostgreSQL (
ON CONFLICT DO UPDATE), SQLite (ON CONFLICT DO UPDATE), MySQL (ON DUPLICATE KEY UPDATE) with fallback to SELECT-then-INSERT/UPDATE. query.Fields[T](): Exported public field name access.db_table_nameergonomics:any/string/boolsentinel types all valid.- List API guidance:
docs/list-api-guidance.mdclarifiesList/ListRows/ListRange/QueryRangeroles. - SQL Server docs: Marked experimental/partial; no CI.
v0.7.0 — 2026-05-23
- PostgreSQL integration tests: 10 tests, opt-in via
SQLH_TEST_POSTGRES=1. - PostgreSQL DDL:
query.TablePG[T]()withSERIAL/BIGSERIAL,bytea, etc. - Placeholder rebinding:
?→$Nfor PostgreSQL drivers. - CI matrix: GitHub Actions with MySQL + PostgreSQL service containers.
- Concurrency fix:
cachedDialectremoved from global state.
v0.6.0 / v0.6.1 — 2026-05-23
- Critical bug fixes: MySQL
AUTO_INCREMENT, PostgreSQLpg_get_serial_sequence, lock-retry robustness,Updatestatement-leak. - API hygiene:
ArgsAppay→ArgsApplywith deprecation alias. - Performance: Zero-alloc read path via addressable struct pointers (4 allocs/op, −69 % vs prior).
- Metadata cache: Struct reflection cached by
reflect.Type.
Active Development Focus
Completed
- ✅ Critical bug fixes — Stage 1 (v0.6.0)
- ✅ ArgsAppay → ArgsApply rename — Stage 2 (v0.6.0)
- ✅ Zero-alloc read path — Stage 3 (v0.6.0)
- ✅ PostgreSQL support — Stage 4 (v0.7.0)
- ✅ Native UPSERT — Stage 5 (v0.7.1)
- ✅ Type-safe WHERE helpers — Stage 6 (v0.8.0)
- ✅ Benchmarks, comparisons, animated GIF — Stage 6 (v0.8.0)
- ✅ Schema migrations (experimental) — Stage 7
- ✅ v0.8.0 tag — Annotated tag created (2026-06-12); GitHub Release notes pending
Remaining Short-term items
- Publish v0.8.0 GitHub Release notes — after this PR is merged.
Medium-term (Phase 2)
- Aggregate functions: GROUP BY, HAVING, SUM, AVG, MIN, MAX
- Batch operations: Multi-row insert/update in a single query
Known Issues
| # | Issue | Severity | Status |
|---|---|---|---|
| 1 | Context support partially implemented in write paths | Medium | Known |
| 2 | JOIN composite struct setup requires manual convention | Low | Known |
| 3 | Lock-retry isLockError still uses string matching | Low | ✅ Mitigated |
| 4 | SQL Server support is experimental, no CI | Medium | Known |
Current Design Decisions Being Evaluated
- ✅ Issue #17 resolved — List API guidance clarified in v0.7.1.
- Whether to use a builder pattern for complex queries (similar to GORM's chainable API) or continue with attribute-based configuration
- How to implement aggregate functions with database-specific SQL syntax
- Memory Bank file naming — current names differ from AGENTS.md convention. Rename requires discussion due to external link impact.
Next Milestones
- Short-term: Publish v0.8.0 GitHub Release notes and community announcement posts.
- Medium-term: Aggregate functions, schema migrations, batch operations
- v1.0.0: Stable API with full database compatibility
Testing Status
- SQLite tests: ✅ Passing (primary test suite)
- MySQL tests: ✅ Gated behind
SQLH_MYSQL_TEST=1 - PostgreSQL tests: ✅ Gated behind
SQLH_TEST_POSTGRES=1 - Query generation tests: ✅ Passing
- Table wrapper tests: ✅ Passing
- Metadata cache tests: ✅ Passing
- Retry logic tests: ✅ Passing
- Batch Update test (200 rows): ✅ Passing
Release Cadence
| Version | Date | Highlights |
|---|---|---|
| v0.1.0 | 2025-06-05 | Initial release |
| v0.1.1 | 2025-06-21 | Added Update function |
| v0.2.0 | 2025-06-21 | Atomic operations, autoincrement fix |
| v0.2.1 | 2025-06-23 | Transaction close fix, bool handling fix |
| v0.2.2 | 2025-10-26 | ListRange iterator, expanded arg types |
| v0.4.0 | 2025-11-15 | Lock retry, metadata cache, JOIN, flexible SELECT, advanced WHERE |
| v0.5.0 | 2025-12-01 | Table[T] wrapper API |
| v0.5.1 | 2026-01-15 | Custom table name, CRUD example updates |
| v0.6.0 | 2026-05-23 | Critical fixes, ArgsApply rename, zero-alloc read path, metadata cache |
| v0.6.1 | 2026-05-23 | Patch (no functional changes) |
| v0.7.0 | 2026-05-23 | PostgreSQL integration tests, PG DDL, placeholder rebinding, CI matrix |
| v0.7.1 | 2026-06-11 | Native UPSERT, FieldsT, List API guidance, SQL Server docs |
| v0.8.0 | 2026-06-12 | Type-safe WHERE helpers, benchmarks, comparisons, animated GIF demo |