Severity: 🟠HIGH — --database mongodb does not compile end-to-end
After the 1.25.x fixes, a MongoDB project's main.go and repository now compile, but the DI container is generated GORM-shaped and breaks the build.
Reproduction
goca init m --module github.com/test/m --database mongodb
cd m
goca feature Item --fields "name:string,qty:int"
goca integrate --all
go build ./...
Actual
internal/di/container.go: undefined: repository.NewPostgresItemRepository
internal/di/container.go is generated with db *gorm.DB, NewContainer(db *gorm.DB) and repository.NewPostgresItemRepository(c.db), but the MongoDB repository constructor is NewMongoItemRepository(db *mongo.Database), and the Mongo main.go exposes a mongoClient *mongo.Client, not a *gorm.DB.
Expected
For mongodb, the DI container should:
- take a
*mongo.Database (derived from the mongoClient),
- call
repository.NewMongo<Entity>Repository(...),
- and be wired into the Mongo
main.go.
Notes / current state
Severity: 🟠HIGH —
--database mongodbdoes not compile end-to-endAfter the 1.25.x fixes, a MongoDB project's
main.goand repository now compile, but the DI container is generated GORM-shaped and breaks the build.Reproduction
Actual
internal/di/container.gois generated withdb *gorm.DB,NewContainer(db *gorm.DB)andrepository.NewPostgresItemRepository(c.db), but the MongoDB repository constructor isNewMongoItemRepository(db *mongo.Database), and the Mongomain.goexposes amongoClient *mongo.Client, not a*gorm.DB.Expected
For
mongodb, the DI container should:*mongo.Database(derived from themongoClient),repository.NewMongo<Entity>Repository(...),main.go.Notes / current state
integrateno longer injects GORM wiring into the Mongomain.go(it would reference an undefineddb) — PR fix(db): driver-correct DSN + auto-migration so generated CRUD actually works (SQLite default was broken) #54 leaves Mongomain.gountouched and prints a warning.