Split heavy optional adapters into opt-in modules (#5) - #13
Merged
Conversation
The core module pulled in go-redis, mongo-driver, GORM, and extra SQL drivers purely for the optional adapter packages, making the PostgreSQL-first install path look heavier than it is. Give each heavy adapter its own Go module so its dependencies leave the core module graph: - pkg/adapters/sqlstore (database/sql; sqlite in tests only) - pkg/adapters/redisstore (go-redis; miniredis in tests) - pkg/adapters/gormstore (GORM; depends on sqlstore module) - pkg/adapters/mongostore (mongo-driver) Each adapter module uses a `replace` to build against the in-repo core during development; external consumers ignore the replace and resolve the required version from the proxy. Import paths and APIs are unchanged, so existing users only add a `go get` for the adapter they use (documented in docs/drop-in-adapters.md). Result: the core go.mod no longer requires go-redis, mongo-driver, GORM, miniredis, or glebarez/sqlite. modernc.org/sqlite remains only as a test dependency of pkg/migrate and is pruned from consumers' module graphs. - Add a CI job that builds and tests the four adapter modules. - go.work is git-ignored; in-repo modules resolve via replace. - README: describe the lightweight core path; tick the roadmap item. Closes #5 Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Closes #5. Splits the heavy optional adapters into separate opt-in Go modules so the PostgreSQL-first core install path stays lightweight.
What changed
The core module pulled in go-redis, mongo-driver, GORM, and extra SQL drivers solely for the optional adapter packages. Each heavy adapter now has its own
go.mod:pkg/adapters/sqlstoredatabase/sql(sqlite in tests only)pkg/adapters/redisstorego-redis(miniredis in tests)pkg/adapters/gormstoregorm(+ depends on the sqlstore module)pkg/adapters/mongostoremongo-driverEach adapter module uses a
replaceso it builds against the in-repo core during development; external consumers ignore the replace and resolve the required version from the proxy. Import paths and APIs are unchanged.Result
The core
go.modno longer requiresgo-redis,mongo-driver,gorm,miniredis, orglebarez/sqlite. Its direct requires are now just chi, pgx, and golang.org/x/crypto (plusmodernc.org/sqlite, which is a test-only dep ofpkg/migrateand is pruned from consumers' module graphs).Migration for existing adapter users
No code changes — just add the module you use:
Documented in
docs/drop-in-adapters.md.Verification
go build/go vet/go test(core + 4 adapters).go.workis git-ignored (in-repo resolution viareplace).🤖 Generated with Claude Code