Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewGolang ¶
func NewGolang(source *GolangSource, updateVersion UpdateVersionFunc, applied AppliedVersionsFunc, config *GolangConfig) (m.Driver, error)
NewGolang creates a new Go migration driver. It requires a source a function for saving the executed migration version, a function for deleting a version that was migrated downwards, a function for listing all applied migrations and optionally a configuration.
Types ¶
type AppliedVersionsFunc ¶
type AppliedVersionsFunc func(config *GolangConfig) ([]string, error)
type GolangConfig ¶
func NewGolangConfig ¶
func NewGolangConfig() *GolangConfig
NewGolangConfig creates a concurrency-safe configuration map for passing configuration data and things like database handlers to your migrations.
func (*GolangConfig) Get ¶
func (c *GolangConfig) Get(key interface{}) interface{}
Get retrieves a value from the configuration using the key.
func (*GolangConfig) Set ¶
func (c *GolangConfig) Set(key, val interface{})
Set adds a new key-value pair to the configuration.
type GolangSource ¶
func NewGolangSource ¶
func NewGolangSource() *GolangSource
NewGolangSource creates a source for storing Go functions as migrations.
func (*GolangSource) AddMigration ¶
func (s *GolangSource) AddMigration(file string, direction m.Direction, migration func(c *GolangConfig) error)
AddMigration adds a new migration to the source. The file parameter follows the same conventions as you would use for a physical file for other types of migrations, however you should omit the file extension. Example: 1_init.up and 1_init.down
func (*GolangSource) GetMigrationFile ¶
func (s *GolangSource) GetMigrationFile(file string) (io.Reader, error)
GetMigrationFile retrieves a migration given the filename.
func (*GolangSource) ListMigrationFiles ¶
func (s *GolangSource) ListMigrationFiles() ([]string, error)
ListMigrationFiles lists the available migrations in the source
type UpdateVersionFunc ¶
type UpdateVersionFunc func(id string, direction m.Direction, config *GolangConfig) error