Documentation ¶
Overview ¶
Package msql creates connections to MySQL datastores.
Index ¶
Constants ¶
View Source
const ( // Protocol of the database driver. Protocol = "tcp" // DriverName of the database. DriverName = "mysql" // Timeout default in seconds for a database connection. Timeout = 30 )
Variables ¶
View Source
var ( ErrConfig = errors.New("no connection configuration was provided") ErrConnect = errors.New("no connection to the mysql database server") ErrDB = errors.New("database handle pointer cannot be nil") ErrDatabase = errors.New("name of the database to connect is missing") ErrTimeout = errors.New("connection timeout is too short") ErrHost = errors.New("host name of the database server is missing") ErrUser = errors.New("user for database login is missing") )
Functions ¶
Types ¶
type Connection ¶
type Connection struct { Host string // Host is the host name of the server. Port uint // Port is the port number the server is listening on. Database string // Database is the database name. User string // User is the database user used to connect to the database. Pass string // Pass is the password for the database user. // NoSSLMode connects to the database using an insecure, // plain text connecction using the sslmode=disable param. NoSSLMode bool Timeout time.Duration // Timeout context in seconds. }
Connection details of the MySQL database connection.
func (*Connection) Check ¶
func (c *Connection) Check() error
func (Connection) MaskPass ¶
func (c Connection) MaskPass(err error) error
MaskPass returns a MySQL database connection error with the user password removed.
func (Connection) Open ¶
func (c Connection) Open() (*sql.DB, error)
Open opens a MySQL database connection.
func (Connection) String ¶
func (c Connection) String() string
String returns a MySQL database connection.
Click to show internal directories.
Click to hide internal directories.