Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AssetMigrationSource ¶
type AssetMigrationSource struct {
// Asset should return content of file in path if exists
Asset func(path string) ([]byte, error)
// AssetDir should return list of files in the path
AssetDir func(path string) ([]string, error)
// Path in the bindata to use.
Dir string
}
AssetMigrationSource is a MigrationSource that uses migration files embedded in a Go application.
func (AssetMigrationSource) GetMigrationFile ¶
func (a AssetMigrationSource) GetMigrationFile(name string) (io.Reader, error)
func (AssetMigrationSource) ListMigrationFiles ¶
func (a AssetMigrationSource) ListMigrationFiles() ([]string, error)
type Driver ¶
type Driver interface {
// Close is the last function to be called.
// Close any open connection here.
Close() error
// Migrate is the heart of the driver.
// It will receive a PlannedMigration which the driver should apply
// to its backend or whatever.
Migrate(migration *PlannedMigration) error
// Version returns all applied migration versions
Versions() ([]string, error)
}
Driver is the interface type that needs to implemented by all drivers.
type MemoryMigrationSource ¶
MemoryMigrationSource is a MigrationSource that uses migration sources in memory. It is mainly used for testing.
func (MemoryMigrationSource) GetMigrationFile ¶
func (m MemoryMigrationSource) GetMigrationFile(name string) (io.Reader, error)
func (MemoryMigrationSource) ListMigrationFiles ¶
func (m MemoryMigrationSource) ListMigrationFiles() ([]string, error)
type Migration ¶
Migration represents a migration, containing statements for migrating up and down.
func (Migration) NumberPrefixMatches ¶
func (Migration) VersionInt ¶
VersionInt converts the migration version to an 64-bit integer.
type PlannedMigration ¶
PlannedMigration is a migration with a direction defined. This allows the driver to work out how to apply the migration.
Click to show internal directories.
Click to hide internal directories.
