diff options
Diffstat (limited to 'src/pkg/database/sql/driver/driver.go')
-rw-r--r-- | src/pkg/database/sql/driver/driver.go | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/src/pkg/database/sql/driver/driver.go b/src/pkg/database/sql/driver/driver.go index 7f986b80f..2f5280db8 100644 --- a/src/pkg/database/sql/driver/driver.go +++ b/src/pkg/database/sql/driver/driver.go @@ -43,6 +43,17 @@ type Driver interface { // documented. var ErrSkip = errors.New("driver: skip fast-path; continue as if unimplemented") +// ErrBadConn should be returned by a driver to signal to the sql +// package that a driver.Conn is in a bad state (such as the server +// having earlier closed the connection) and the sql package should +// retry on a new connection. +// +// To prevent duplicate operations, ErrBadConn should NOT be returned +// if there's a possibility that the database server might have +// performed the operation. Even if the server sends back an error, +// you shouldn't return ErrBadConn. +var ErrBadConn = errors.New("driver: bad connection") + // Execer is an optional interface that may be implemented by a Conn. // // If a Conn does not implement Execer, the db package's DB.Exec will |