]> Cypherpunks repositories - gostls13.git/commitdiff
database/sql/driver: rename ResetSessioner to SessionResetter
authorRuss Cox <rsc@golang.org>
Wed, 15 Nov 2017 20:07:44 +0000 (15:07 -0500)
committerRuss Cox <rsc@golang.org>
Wed, 15 Nov 2017 21:28:18 +0000 (21:28 +0000)
Originally we tried the strict -er suffix as the rule in this case
but eventually we decided it was too awkward: io.WriteByter
became io.ByteWriter. By analogy, here the interface should be
named SessionResetter instead of the awkward ResetSessioner.

This change should not affect any drivers that have already
implemented the interface, because the method name is not changing.

(This was added during the Go 1.10 cycle and has not been
released yet, so we can change it.)

Change-Id: Ie50e4e090d3811f85965da9da37d966e9f45e79d
Reviewed-on: https://go-review.googlesource.com/78127
Run-TryBot: Russ Cox <rsc@golang.org>
Reviewed-by: Daniel Theophanes <kardianos@gmail.com>
src/database/sql/driver/driver.go
src/database/sql/sql.go

index 6113af79c573b4de28842126b8831b5cd2d5367a..6bea8f9de906ceace67995c083611f958c0a0b93 100644 (file)
@@ -222,9 +222,9 @@ type ConnBeginTx interface {
        BeginTx(ctx context.Context, opts TxOptions) (Tx, error)
 }
 
-// ResetSessioner may be implemented by Conn to allow drivers to reset the
+// SessionResetter may be implemented by Conn to allow drivers to reset the
 // session state associated with the connection and to signal a bad connection.
-type ResetSessioner interface {
+type SessionResetter interface {
        // ResetSession is called while a connection is in the connection
        // pool. No queries will run on this connection until this method returns.
        //
index 252a0f6713c25f9b085f879f37e8cba203d69e46..30b4ad36093737fb2dca87c280124576ef4f1e01 100644 (file)
@@ -431,7 +431,7 @@ func (dc *driverConn) resetSession(ctx context.Context) {
        if dc.closed {    // Check if the database has been closed.
                return
        }
-       dc.lastErr = dc.ci.(driver.ResetSessioner).ResetSession(ctx)
+       dc.lastErr = dc.ci.(driver.SessionResetter).ResetSession(ctx)
 }
 
 // the dc.db's Mutex is held.
@@ -1178,7 +1178,7 @@ func (db *DB) putConn(dc *driverConn, err error, resetSession bool) {
                resetSession = false
        }
        if resetSession {
-               if _, resetSession = dc.ci.(driver.ResetSessioner); resetSession {
+               if _, resetSession = dc.ci.(driver.SessionResetter); resetSession {
                        // Lock the driverConn here so it isn't released until
                        // the connection is reset.
                        // The lock must be taken before the connection is put into