mysql

package
v0.0.2 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	MaxIdleConns = 5
	MaxOpenConns = 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

New - 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

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

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

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

func (*MySQL) Install

func (m *MySQL) Install() error

Install

Migrate the db by executing the MySQL migration file. Returns errors.INVALID if the sql file could not be located. Returns errors.INTERNAL if the exec command could not be ran.

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