Documentation ¶
Index ¶
- Variables
- func Available() map[string]Driver
- func Columns(u *dburl.URL, rows *sql.Rows) ([]string, error)
- func ConvertBytes(u *dburl.URL, buf []byte) string
- func IsPasswordErr(u *dburl.URL, err error) bool
- func NextResultSet(q *sql.Rows) bool
- func Open(u *dburl.URL, buf *stmt.Stmt) (*sql.DB, error)
- func Ping(u *dburl.URL, db *sql.DB) error
- func Process(u *dburl.URL, prefix, sqlstr string) (string, string, bool, error)
- func QueryExecType(prefix, sqlstr string) (string, bool)
- func Register(name string, d Driver, aliases ...string)
- func Registered(name string) bool
- func RowsAffected(u *dburl.URL, res sql.Result) (int64, error)
- func Version(u *dburl.URL, db *sql.DB) (string, error)
- func WrapErr(name string, err error) error
- type Driver
- type ErrVerbose
- type Error
Constants ¶
This section is empty.
Variables ¶
var ( // ErrDriverNotAvailable is the driver not available error. ErrDriverNotAvailable = errors.New("driver not available") )
Functions ¶
func Columns ¶ added in v0.4.0
Columns returns the columns for SQL result for the specified URL's driver.
func ConvertBytes ¶ added in v0.4.0
ConvertBytes converts a raw byte slice for a specified URL's driver.
func IsPasswordErr ¶ added in v0.4.0
IsPasswordErr returns true if the specified err is a password error for the specified URL's driver.
func NextResultSet ¶ added in v0.4.0
NextResultSet is a wrapper around the go1.8 introduced sql.Rows.NextResultSet call.
func Process ¶ added in v0.4.0
Process processes the supplied SQL query for the specified URL's driver.
func QueryExecType ¶ added in v0.4.0
QueryExecType is the default way to determine the "EXEC" prefix for a SQL query and whether or not it should be Exec'd or Query'd.
func Registered ¶ added in v0.4.0
Registered returns whether or not a specific driver has been registered.
func RowsAffected ¶ added in v0.4.0
RowsAffected returns the rows affected for the SQL result for a specified URL's driver.
Types ¶
type Driver ¶ added in v0.4.0
type Driver struct { // N is a name to override the driver name with. N string // O will be used by Open if defined. O func(*dburl.URL) (func(string, string) (*sql.DB, error), error) // V will be used by Version if defined. V func(*sql.DB) (string, error) // PwErr will be used by IsPasswordErr if defined. PwErr func(error) bool // P will be used by Process if defined. P func(string, string) (string, string, bool, error) // Cols will be used to retrieve the columns for the rows if defined. Cols func(*sql.Rows) ([]string, error) // Cb will be used by ConvertBytes to convert a raw []byte slice to a // string if defined. Cb func([]byte) string // E will be used by Error.Error if defined. E func(error) (string, string) // EV will be used by Error.Verbose if defined. EV func(error) *ErrVerbose // A will be used by RowsAffected if defined. A func(sql.Result) (int64, error) }
Driver holds funcs for a driver.
type ErrVerbose ¶ added in v0.4.0
type ErrVerbose struct { }
ErrVerbose standardizes the verbose information about an error.
type Error ¶ added in v0.4.0
Error is a wrapper to standardize errors.
func (*Error) Error ¶ added in v0.4.0
Error satisfies the error interface, returning simple information about the wrapped error in standardized way.
func (*Error) Verbose ¶ added in v0.4.0
func (e *Error) Verbose() *ErrVerbose
Verbose returns more information about the wrapped error.