Documentation ¶
Index ¶
- Variables
- func LogOnError(ctx context.Context, f func() error)
- type MySQLDriver
- func (driver *MySQLDriver) Close() error
- func (tn MySQLDriver) Metadata() string
- func (tn MySQLDriver) Namespace() string
- func (tn MySQLDriver) RelationTuple() string
- func (tn MySQLDriver) RelationTupleTransaction() string
- func (driver *MySQLDriver) Version() (string, error)
- func (driver *MySQLDriver) WriteVersion(version, replaced string) error
Constants ¶
This section is empty.
Variables ¶
var ( // Manager is the singleton migration manager instance for MySQL Manager = migrate.NewManager() )
Functions ¶
func LogOnError ¶
LogOnError executes the function and logs the error. Useful to avoid silently ignoring errors in defer statements
Types ¶
type MySQLDriver ¶
type MySQLDriver struct {
// contains filtered or unexported fields
}
MySQLDriver is an implementation of migrate.Driver for MySQL
func NewMySQLDriverFromDB ¶
func NewMySQLDriverFromDB(db *sql.DB, tablePrefix string) *MySQLDriver
NewMySQLDriverFromDB creates a new migration driver with a connection pool specified upfront.
func NewMySQLDriverFromDSN ¶
func NewMySQLDriverFromDSN(url string, tablePrefix string) (*MySQLDriver, error)
NewMySQLDriverFromDSN creates a new migration driver with a connection pool to the database DSN specified.
URI: [scheme://][user[:[password]]@]host[:port][/schema][?attribute1=value1&attribute2=value2... See https://dev.mysql.com/doc/refman/8.0/en/connecting-using-uri-or-key-value-pairs.html
func (*MySQLDriver) Close ¶
func (driver *MySQLDriver) Close() error
func (MySQLDriver) Namespace ¶
func (tn MySQLDriver) Namespace() string
Namespace returns the prefixed namespace table name.
func (MySQLDriver) RelationTuple ¶
func (tn MySQLDriver) RelationTuple() string
RelationTuple returns the prefixed relationship tuple table name.
func (MySQLDriver) RelationTupleTransaction ¶
func (tn MySQLDriver) RelationTupleTransaction() string
RelationTupleTransaction returns the prefixed transaction table name.
func (*MySQLDriver) Version ¶
func (driver *MySQLDriver) Version() (string, error)
Version returns the version of the schema to which the connected database has been migrated.
func (*MySQLDriver) WriteVersion ¶
func (driver *MySQLDriver) WriteVersion(version, replaced string) error
WriteVersion overwrites the _meta_version_ column name which encodes the version of the database schema.