Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Sqlx ¶
type Sqlx struct { Migrations []SqlxMigration // Printf is used to print out additional information during a migration, such // as which step the migration is currently on. It can be replaced with any // custom printf function, including one that just ignores inputs. If nil it // will default to fmt.Printf. Printf func(format string, a ...interface{}) (n int, err error) }
Sqlx is a migrator that uses github.com/jmoiron/sqlx
type SqlxMigration ¶
type SqlxMigration struct { ID string Migrate func(tx *sqlx.Tx) error Rollback func(tx *sqlx.Tx) error }
SqlxMigration is a unique ID plus a function that uses a sqlx transaction to perform a database migration step.
Note: Long term this could have a Rollback field if we wanted to support that.
func SqlxFileMigration ¶
func SqlxFileMigration(id, upFile, downFile string) SqlxMigration
SqlxFileMigration will create a SqlxMigration using the provided file.
func SqlxQueryMigration ¶
func SqlxQueryMigration(id, upQuery, downQuery string) SqlxMigration
SqlxQueryMigration will create a SqlxMigration using the provided id and query string. It is a helper function designed to simplify the process of creating migrations that only depending on a SQL query string.
Click to show internal directories.
Click to hide internal directories.