Documentation ¶
Index ¶
- func Available() map[string]Driver
- func CanChangePassword(u *dburl.URL) error
- func ChangePassword(u *dburl.URL, db DB, user, new, old string) (string, error)
- func Columns(u *dburl.URL, rows *sql.Rows) ([]string, error)
- func ConfigStmt(u *dburl.URL, s *stmt.Stmt)
- func ConvertBytes(u *dburl.URL, tfmt string, buf []byte) string
- func ForceParams(u *dburl.URL)
- func ForceQueryParameters(params []string) func(*dburl.URL)
- func IsPasswordErr(u *dburl.URL, err error) bool
- func Lexer(u *dburl.URL) chroma.Lexer
- func NewStmt(u *dburl.URL, f func() ([]rune, error), opts ...stmt.Option) *stmt.Stmt
- func NextResultSet(q *sql.Rows) bool
- func Open(u *dburl.URL) (*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 RequirePreviousPassword(u *dburl.URL) bool
- func RowsAffected(u *dburl.URL, res sql.Result) (int64, error)
- func User(u *dburl.URL, db DB) (string, error)
- func Version(u *dburl.URL, db DB) (string, error)
- func WrapErr(driver string, err error) error
- type DB
- type Driver
- type Error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CanChangePassword ¶ added in v0.5.0
CanChangePassword returns whether or not the specified driver's URL supports changing passwords.
func ChangePassword ¶ added in v0.5.0
ChangePassword initiates a user password change for the specified URL's driver. If user is not supplied, then the current user will be retrieved from User.
func Columns ¶ added in v0.4.0
Columns returns the columns for SQL result for the specified URL's driver.
func ConfigStmt ¶ added in v0.6.0
ConfigStmt sets the stmt.Stmt options for the specified driver.
func ConvertBytes ¶ added in v0.4.0
ConvertBytes converts a raw byte slice for a specified URL's driver.
func ForceParams ¶ added in v0.6.0
ForceParams forces parameters on the supplied DSN for the registered driver.
func ForceQueryParameters ¶ added in v0.6.0
ForceQueryParameters is a utility func that wraps forcing params of name, value pairs.
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 RequirePreviousPassword ¶ added in v0.5.0
RequirePreviousPassword returns true if the specified URL's driver requires a previous password when changing a user's password.
func RowsAffected ¶ added in v0.4.0
RowsAffected returns the rows affected for the SQL result for a specified URL's driver.
Types ¶
type DB ¶ added in v0.5.0
type DB interface { Exec(string, ...interface{}) (sql.Result, error) Query(string, ...interface{}) (*sql.Rows, error) QueryRow(string, ...interface{}) *sql.Row Prepare(string) (*sql.Stmt, error) }
DB is the common interface for database operations, compatible with database/sql.DB and database/sql.Tx.
type Driver ¶ added in v0.4.0
type Driver struct { // Name is a name to override the driver name with. Name string // AllowDollar will be passed to query buffers to enable dollar ($$) style // strings. AllowDollar bool // AllowMultilineComments will be passed to query buffers to enable // multiline (/**/) style comments. AllowMultilineComments bool // AllowCComments will be passed to query buffers to enable C (//) style // comments. AllowCComments bool // AllowHashComments will be passed to query buffers to enable hash (#) // style comments. AllowHashComments bool // RequirePreviousPassword will be used by RequirePreviousPassword. RequirePreviousPassword bool // LexerName is the name of the syntax lexer to use. LexerName string // ForceParams will be used to force parameters if defined. ForceParams func(*dburl.URL) // Open will be used by Open if defined. Open func(*dburl.URL) (func(string, string) (*sql.DB, error), error) // Version will be used by Version if defined. Version func(DB) (string, error) // User will be used by User if defined. User func(DB) (string, error) // ChangePassword will be used by ChangePassword if defined. ChangePassword func(DB, string, string, string) error // IsPasswordErr will be used by IsPasswordErr if defined. IsPasswordErr func(error) bool // Process will be used by Process if defined. Process func(string, string) (string, string, bool, error) // Columns will be used to retrieve the columns for the rows if // defined. Columns func(*sql.Rows) ([]string, error) // ConvertBytes will be used by ConvertBytes to convert a raw []byte // slice to a string if defined. ConvertBytes func(string, []byte) string // Err will be used by Error.Error if defined. Err func(error) (string, string) // RowsAffected will be used by RowsAffected if defined. RowsAffected func(sql.Result) (int64, error) }
Driver holds funcs for a driver.