Files
go-migrate-db/internal/app/db-wrapper/main.go
Kylesoda f0caa55a21 feat: add source and target database type fields
Add source_db_type and target_db_type to the migration config so the same binary can drive any supported direction.
2026-04-17 13:00:00 -05:00

20 lines
370 B
Go

package dbwrapper
import "fmt"
type Factory func() DbWrapper
var drivers = make(map[string]Factory)
func Register(name string, factory Factory) {
drivers[name] = factory
}
func New(driverType string) (DbWrapper, error) {
factory, ok := drivers[driverType]
if !ok {
return nil, fmt.Errorf("driver not yet supported: %s", driverType)
}
return factory(), nil
}