Documentation ¶
Index ¶
- Constants
- type MySQL
- func (m *MySQL) Builder() *builder.Sqlbuilder
- func (m *MySQL) Close() error
- func (m *MySQL) DB() *sqlx.DB
- func (m *MySQL) Drop() error
- func (m *MySQL) Dump(path, filename string) error
- func (m *MySQL) Exists() error
- func (m *MySQL) Install() error
- func (m *MySQL) Migrate(ver *sm.Version) error
- func (m *MySQL) Schema() string
- func (m *MySQL) Tables() ([]string, error)
Constants ¶
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) Drop ¶
Drop deletes the database with the environments database name. Returns errors.INTERNAL if the exec command could not be ran.
func (*MySQL) Dump ¶
Dump the database to file with the given path and file name. Returns errors.INTERNAL if the connection, dump failed.
func (*MySQL) Exists ¶
Exists check's if the database exists. Returns errors.INVALID if the database was not found.
func (*MySQL) Install ¶
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.