driver

package
v0.0.0-...-49c89df Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Sep 28, 2023 License: Apache-2.0 Imports: 2 Imported by: 4

Documentation

Index

Constants

View Source
const (
	// DialectPostgres is the family name of the postgres driver.
	DialectPostgres = "postgres"

	// DialectMySQL is the family name of the mysql driver.
	DialectMySQL = "mysql"

	// DialectSQLite is the family name of the sqlite driver.
	DialectSQLite = "sqlite"

	// DialectMSSQL is the family name of the mssql driver.
	DialectMSSQL = "mssql"

	// DialectOracle is the family name of the oracle driver.
	DialectOracle = "oracle"

	// DialectCockroach is the family name of the cockroach driver.
	DialectCockroach = "cockroach"

	// DialectYugabyte is the family name of the yugabyte driver.
	DialectYugabyte = "yugabyte"

	// DialectTiDB is the family name of the tidb driver.
	DialectTiDB = "tidb"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type DB

type DB interface {
	// Dialect returns the dialect of the driver.
	// I.e. if the driver implements a protocol that matches multiple
	// database dialects (such as postgres and cockroachdb), it should
	// return the dialect name.
	Dialect() string

	// DriverName returns the name of the driver.
	DriverName() string

	// ErrorCode returns the error code of the given error
	// if the driver supports it.
	ErrorCode(err error) bserr.Code

	// DB returns the underlying database/sql.DB.
	DB() *sql.DB

	// ErrorColumn returns the column name of the given error
	// if the driver doesn't support it, it should return an empty string.
	ErrorColumn(err error) string

	// ErrorTable returns the table name of the given error
	// if the driver doesn't support it, it should return an empty string.
	ErrorTable(err error) string

	// ErrorConstraint returns the constraint name of the given error
	// if the driver doesn't support it, it should return an empty string.
	ErrorConstraint(err error) string

	// HasErrorDetails returns true if the driver supports error details,
	// such as column, table and constraint name.
	HasErrorDetails() bool
}

DB is a driver specific wrapper over the database/sql.DB.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL