MCPcopy
hub / github.com/rubenv/sql-migrate / GetConnection

Function GetConnection

sql-migrate/config.go:98–111  ·  view source on GitHub ↗
(env *Environment)

Source from the content-addressed store, hash-verified

96}
97
98func GetConnection(env *Environment) (*sql.DB, string, error) {
99 db, err := sql.Open(env.Dialect, env.DataSource)
100 if err != nil {
101 return nil, "", fmt.Errorf("Cannot connect to database: %w", err)
102 }
103
104 // Make sure we only accept dialects that were compiled in.
105 _, exists := dialects[env.Dialect]
106 if !exists {
107 return nil, "", fmt.Errorf("Unsupported dialect: %s", env.Dialect)
108 }
109
110 return db, env.Dialect, nil
111}
112
113// GetVersion returns the version.
114func GetVersion() string {

Callers 4

SkipMigrationsFunction · 0.85
RunMethod · 0.85
RunMethod · 0.85
ApplyMigrationsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…