Documentation ¶
Index ¶
Constants ¶
const ( Head = "head" None = "" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Driver ¶
type Driver interface { // Version returns the current version of the schema in the backing datastore. // If the datastore is brand new, version should return the empty string without // an error. Version() (string, error) // WriteVersion records the newly migrated version to the backing datastore. WriteVersion(version, replaced string) error }
Driver represents the common interface for reading and writing the revision data from a migrateable backing datastore.
type Manager ¶
type Manager struct {
// contains filtered or unexported fields
}
Manager is used to manage a self-contained set of migrations. Standard usage would be to instantiate one at the package level for a particular application and then statically register migrations to the single instantiation in init functions.
func NewManager ¶
func NewManager() *Manager
NewManager creates a new empty instance of a migration manager.
func (*Manager) HeadRevision ¶
func (*Manager) Register ¶
Register is used to associate a single migration with the migration engine. The up parameter should be a function that performs the actual upgrade logic and which takes a pointer to a concrete implementation of the Driver interface as its only parameters, which will be passed direcly from the Run method into the upgrade function. If not extra fields or data are required the function can alternatively take a Driver interface param.