2
0

Add driver.Pinger support to stdlib.Conn

This commit is contained in:
Jack Christensen
2017-05-19 08:54:08 -05:00
parent e1397613fd
commit 936cb68866
2 changed files with 58 additions and 0 deletions
+8
View File
@@ -336,6 +336,14 @@ func (c *Conn) queryPreparedContext(ctx context.Context, name string, argsV []dr
return &Rows{rows: rows}, nil
}
func (c *Conn) Ping(ctx context.Context) error {
if !c.conn.IsAlive() {
return driver.ErrBadConn
}
return c.conn.Ping(ctx)
}
// Anything that isn't a database/sql compatible type needs to be forced to
// text format so that pgx.Rows.Values doesn't decode it into a native type
// (e.g. []int32)