migrations

package
v1.7.0 Latest Latest
Warning

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

Go to latest
Published: Apr 27, 2022 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// Manager is the singleton migration manager instance for MySQL
	Manager = migrate.NewManager()
)

Functions

func LogOnError

func LogOnError(ctx context.Context, f func() error)

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) Metadata

func (tn MySQLDriver) Metadata() string

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.

Jump to

Keyboard shortcuts

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