Merge 335f09749bcbb05e9e1935ab57dfd03cc222c3b9 into 6b8f2fcab8b2db599481fe2aa13ee97b63811d37
This commit is contained in:
commit
63abe54497
5
main.go
5
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
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user