diff --git a/main.go b/main.go index 30802205..952ca0fd 100644 --- a/main.go +++ b/main.go @@ -59,6 +59,7 @@ func Open(dialect string, args ...interface{}) (DB, error) { driver = "postgres" // FoundationDB speaks a postgres-compatible protocol. } dbSql, err = sql.Open(driver, source) + case sqlCommon: source = reflect.Indirect(reflect.ValueOf(value)).FieldByName("dsn").String() dbSql = value @@ -79,6 +80,10 @@ func Open(dialect string, args ...interface{}) (DB, error) { } } + if err == nil { + err = db.DB().Ping() // Send a ping to make sure the database connection is alive. + } + return db, err }