Documentation ¶
Overview ¶
Package errsql provides a wrapper for a database/sql/driver.Driver which enables custom error handling before returning any errors.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddStacktrace ¶ added in v0.0.2
AddStacktrace adds a github.com/pkg/error.Stacktrace to the error at the point at which the db function is called. It excludes stack frames in the `database/sql` package, and in this package, as well as from the error handler function.
func WrapConnector ¶ added in v0.0.6
func WrapConnector(c driver.Connector, eh ErrorHandler) driver.Connector
WrapConnector wraps a database/sql/driver.Connector so that any errors returned by its driver.Connector.Connect method are passed through the error handler. Use this in place of New if you already have a database/sql/driver.Connector instance that you wish to wrap.
Types ¶
type Driver ¶
type Driver struct {
// contains filtered or unexported fields
}
Driver is the core type implementing the database/sql/driver.Driver interface.
type ErrorHandler ¶
ErrorHandler is a function which is called for any error.