mysql

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2021 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MaxIdleConnections represents the maximum amount
	// of idle connections for MySQL.
	MaxIdleConnections = 5
	// MaxOpenConnections represents the maximum amount
	// of open connections for MySQL.
	MaxOpenConnections = 100
)

Variables

This section is empty.

Functions

This section is empty.

Types

type MySQL

type MySQL struct {
	// contains filtered or unexported fields
}

MySQL defines the implementation of the MySQL.Driver if MySQL is selected as the main driver.

func Setup

func Setup(env *environment.Env) (*MySQL, error)

Setup creates a new MySQL instance and returns a new database driver. Returns errors.INVALID if there was an error establishing a connection or pinging.

func (*MySQL) Builder

func (m *MySQL) Builder() *builder.Sqlbuilder

Builder returns a new query builder instance.

func (*MySQL) Close

func (m *MySQL) Close() error

Close closes the MySQL connection.

func (*MySQL) DB

func (m *MySQL) DB() *sqlx.DB

DB returns the sqlx driver.

func (*MySQL) Drop

func (m *MySQL) Drop() error

Drop deletes the database with the environments database name. Returns errors.INTERNAL if the exec command could not be ran.

func (*MySQL) Dump

func (m *MySQL) Dump(path, filename string) error

Dump the database to file with the given path and file name. Returns errors.INTERNAL if the connection, dump failed.

func (*MySQL) Exists

func (m *MySQL) Exists() error

Exists check's if the database exists. Returns errors.INVALID if the database was not found.

func (*MySQL) Install

func (m *MySQL) Install() error

Install migrates the the database by executing the MySQL migration file. The migrator is used to traverse the migrations and install the database so it is full up to date. Returns errors.INTERNAL if the migration failed.

func (*MySQL) Migrate added in v0.0.3

func (m *MySQL) Migrate(ver *sm.Version) error

Migrate migrates and updates the database and the file system to the most recent version. Returns errors.INTERNAL if the migration failed.

func (*MySQL) Schema

func (m *MySQL) Schema() string

Schema returns the schema (blank for MySQL),

func (*MySQL) Tables

func (m *MySQL) Tables() ([]string, error)

Tables Runs checks on the Verbis DB installation to see if all the tables exist. If some are missing, a slice of strings will be returned containing the table name. Returns internal.ErrTableNotFound if a table wasn't found.

Jump to

Keyboard shortcuts

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