aboutsummaryrefslogtreecommitdiff
path: root/src/database/sql/driver
diff options
context:
space:
mode:
Diffstat (limited to 'src/database/sql/driver')
-rw-r--r--src/database/sql/driver/driver.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/database/sql/driver/driver.go b/src/database/sql/driver/driver.go
index bc6aa3b26e..e2ee7a9b28 100644
--- a/src/database/sql/driver/driver.go
+++ b/src/database/sql/driver/driver.go
@@ -69,6 +69,17 @@ var ErrSkip = errors.New("driver: skip fast-path; continue as if unimplemented")
// you shouldn't return ErrBadConn.
var ErrBadConn = errors.New("driver: bad connection")
+// Pinger is an optional interface that may be implemented by a Conn.
+//
+// If a Conn does not implement Pinger, the sql package's DB.Ping and
+// DB.PingContext will check if there is at least one Conn available.
+//
+// If Conn.Ping returns ErrBadConn, DB.Ping and DB.PingContext will remove
+// the Conn from pool.
+type Pinger interface {
+ Ping(ctx context.Context) error
+}
+
// Execer is an optional interface that may be implemented by a Conn.
//
// If a Conn does not implement Execer, the sql package's DB.Exec will