Documentation ¶
Index ¶
- Constants
- Variables
- func Down(metadata *MetaData, config *Config, driver Driver, readable Readable) error
- func Status(metadata *MetaData, config *Config, driver Driver, w io.Writer) error
- func Up(metadata *MetaData, config *Config, driver Driver, readable Readable) error
- type Bindata
- type Config
- type Dir
- type Driver
- type IncrementalVersionG
- type MetaData
- type Migration
- type Migrations
- type Readable
- type TimestampBasedVersionG
- type VersionG
Constants ¶
const MetaDataFileName = "metadata.json"
MetaDataFileName ...
Variables ¶
var ( ErrUnknownDriver = errors.New("unknown driver") ErrEnvNotFound = errors.New("env not found in config") ErrMigrationFileNotFound = errors.New("migration file not found") ErrMigrationsNotExist = errors.New("migrations not exist") ErrSchemaVersionIsZero = errors.New("schema version is 0") )
Various errors the spirali might return.
Functions ¶
Types ¶
type Bindata ¶
type Bindata struct {
// contains filtered or unexported fields
}
Bindata represents just `bindata`.
func NewReadableFromBindata ¶
NewReadableFromBindata ...
func (*Bindata) WithBasePath ¶ added in v1.0.0
WithBasePath sets a base path when read data from bindata.
type Config ¶
Config represents the spirali configuration.
func ReadConfig ¶
ReadConfig reads the spirali configuration from io.Reader.
type Driver ¶
type Driver interface { Close() error CreateVersionTableIfNotExists() error DeleteVersion(version uint64) error Exec(query string) error GetAppliedTimeList() (map[uint64]time.Time, error) GetCurrentVersion() (uint64, error) Open(dsn string) error SetVersion(version uint64) error Transaction(fn func() error) error }
Driver is interface of database driver.
type IncrementalVersionG ¶
type IncrementalVersionG struct {
CurrentVersion uint64
}
IncrementalVersionG is the incremental version generator.
func (*IncrementalVersionG) GenerateNextVersion ¶
func (vg *IncrementalVersionG) GenerateNextVersion() (uint64, error)
GenerateNextVersion ...
type MetaData ¶
type MetaData struct {
Migrations Migrations `json:"migrations"`
}
MetaData of migration.
func ReadMetaData ¶
ReadMetaData reads the metadata of migration from io.Reader.
type Migration ¶
Migration is ...
func NewMigration ¶
NewMigration initialize migration struct.
func (*Migration) GetDownFileName ¶
GetDownFileName generate file name for rolled back migration.
func (*Migration) GetUpFileName ¶
GetUpFileName generate file name for applied migration.
type Migrations ¶
type Migrations []*Migration
Migrations is array of migration.
type TimestampBasedVersionG ¶
type TimestampBasedVersionG struct{}
TimestampBasedVersionG is the timestamp based version generator.
func (*TimestampBasedVersionG) GenerateNextVersion ¶
func (vg *TimestampBasedVersionG) GenerateNextVersion() (uint64, error)
GenerateNextVersion ...