Skip to content

Split heavy optional adapters into opt-in modules (#5) - #13

Merged
darwvin-dev merged 1 commit into
mainfrom
feat/split-adapter-modules
Jun 18, 2026
Merged

Split heavy optional adapters into opt-in modules (#5)#13
darwvin-dev merged 1 commit into
mainfrom
feat/split-adapter-modules

Conversation

@darwvin-dev

Copy link
Copy Markdown
Owner

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:

Module Heavy deps it owns
pkg/adapters/sqlstore database/sql (sqlite in tests only)
pkg/adapters/redisstore go-redis (miniredis in tests)
pkg/adapters/gormstore gorm (+ depends on the sqlstore module)
pkg/adapters/mongostore mongo-driver

Each adapter module uses a replace so 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.mod no longer requires go-redis, mongo-driver, gorm, miniredis, or glebarez/sqlite. Its direct requires are now just chi, pgx, and golang.org/x/crypto (plus modernc.org/sqlite, which is a test-only dep of pkg/migrate and is pruned from consumers' module graphs).

Migration for existing adapter users

No code changes — just add the module you use:

go get github.com/darwvin-dev/gomyadmin/pkg/adapters/redisstore@latest
go mod tidy

Documented in docs/drop-in-adapters.md.

Verification

  • All five modules pass go build / go vet / go test (core + 4 adapters).
  • Root coverage 63.9% (above the 62% gate).
  • New CI job builds and tests the four adapter modules; go.work is git-ignored (in-repo resolution via replace).
  • README updated to describe the lightweight core path; roadmap item ticked.

🤖 Generated with Claude Code

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>
@darwvin-dev
darwvin-dev merged commit 24b1415 into main Jun 18, 2026
3 checks passed
@darwvin-dev
darwvin-dev deleted the feat/split-adapter-modules branch June 18, 2026 07:24
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.

Split heavier optional adapters into opt-in modules or packages

1 participant