From 5aef51a729f428bfd4b2c28fd2ba7950660608e0 Mon Sep 17 00:00:00 2001 From: Daniel Theophanes Date: Wed, 18 Mar 2020 10:03:51 -0700 Subject: database/sql: add test for Conn.Validator interface This addresses comments made by Russ after https://golang.org/cl/174122 was merged. It addes a test for the connection validator and renames the interface to just "Validator". Change-Id: Iea53e9b250c9be2e86e9b75906e7353e26437c5c Reviewed-on: https://go-review.googlesource.com/c/go/+/223963 Reviewed-by: Emmanuel Odeke --- src/database/sql/driver/driver.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'src/database/sql/driver') diff --git a/src/database/sql/driver/driver.go b/src/database/sql/driver/driver.go index a2b844d71f..76f1bd3aa1 100644 --- a/src/database/sql/driver/driver.go +++ b/src/database/sql/driver/driver.go @@ -261,15 +261,15 @@ type SessionResetter interface { ResetSession(ctx context.Context) error } -// ConnectionValidator may be implemented by Conn to allow drivers to +// Validator may be implemented by Conn to allow drivers to // signal if a connection is valid or if it should be discarded. // // If implemented, drivers may return the underlying error from queries, // even if the connection should be discarded by the connection pool. -type ConnectionValidator interface { - // ValidConnection is called prior to placing the connection into the +type Validator interface { + // IsValid is called prior to placing the connection into the // connection pool. The connection will be discarded if false is returned. - ValidConnection() bool + IsValid() bool } // Result is the result of a query execution. -- cgit v1.3