Skip to content

Commit 442d15a

Browse files
committed
database/sql/driver: rename ResetSessioner to SessionResetter
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 <[email protected]> Reviewed-by: Daniel Theophanes <[email protected]>
1 parent cac334c commit 442d15a

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/database/sql/driver/driver.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -222,9 +222,9 @@ type ConnBeginTx interface {
222222
BeginTx(ctx context.Context, opts TxOptions) (Tx, error)
223223
}
224224

225-
// ResetSessioner may be implemented by Conn to allow drivers to reset the
225+
// SessionResetter may be implemented by Conn to allow drivers to reset the
226226
// session state associated with the connection and to signal a bad connection.
227-
type ResetSessioner interface {
227+
type SessionResetter interface {
228228
// ResetSession is called while a connection is in the connection
229229
// pool. No queries will run on this connection until this method returns.
230230
//

src/database/sql/sql.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -431,7 +431,7 @@ func (dc *driverConn) resetSession(ctx context.Context) {
431431
if dc.closed { // Check if the database has been closed.
432432
return
433433
}
434-
dc.lastErr = dc.ci.(driver.ResetSessioner).ResetSession(ctx)
434+
dc.lastErr = dc.ci.(driver.SessionResetter).ResetSession(ctx)
435435
}
436436

437437
// the dc.db's Mutex is held.
@@ -1178,7 +1178,7 @@ func (db *DB) putConn(dc *driverConn, err error, resetSession bool) {
11781178
resetSession = false
11791179
}
11801180
if resetSession {
1181-
if _, resetSession = dc.ci.(driver.ResetSessioner); resetSession {
1181+
if _, resetSession = dc.ci.(driver.SessionResetter); resetSession {
11821182
// Lock the driverConn here so it isn't released until
11831183
// the connection is reset.
11841184
// The lock must be taken before the connection is put into

0 commit comments

Comments
 (0)