aboutsummaryrefslogtreecommitdiff
path: root/src/database/sql/driver/driver.go
diff options
context:
space:
mode:
authorINADA Naoki <songofacandy@gmail.com>2016-10-26 17:11:13 +0900
committerBrad Fitzpatrick <bradfitz@golang.org>2016-10-31 17:17:42 +0000
commit4b90b7a28a0c1a849eed765cc511eacbae4d2651 (patch)
tree0893be9e9db834af58710ee9b1a2787ef078afc4 /src/database/sql/driver/driver.go
parent398e861d9787d7da62a385110539d74dec34c18c (diff)
downloadgo-4b90b7a28a0c1a849eed765cc511eacbae4d2651.tar.xz
database/sql: add Pinger interface to driver Conn
Change-Id: If6eb3a7c9ad48a517e584567b1003479c1df6cca Reviewed-on: https://go-review.googlesource.com/32136 Reviewed-by: Daniel Theophanes <kardianos@gmail.com> Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> TryBot-Result: Gobot Gobot <gobot@golang.org>
Diffstat (limited to 'src/database/sql/driver/driver.go')
-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