Documentation
¶
Index ¶
Constants ¶
View Source
const ( DBpostgresql = iota + 1 DBsqlite3 = iota + 1 DBmysql = iota + 1 )
View Source
const ( MIGRATION_TYPE_UP = "up" MIGRATION_TYPE_DOWN = "down" )
View Source
const ( CONFIG_FILE_NAME = "migdb.yaml" CONFIG_FILE_BASE = "migdb" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DatabaseRepo ¶ added in v0.0.6
type DatabaseRepo interface {
CreateMigrationTableIfNotExists() error
GetLastAppliedMigrationFromDatabase() (*MigrationEntry, error)
ApplyMigration(migration *SqlMigration) error
GetMigrationEntries() (*[]MigrationEntry, error)
DeleteMigrationTable() error
}
type FileSystemRepo ¶ added in v0.0.2
type FileSystemRepo interface {
MkAlldirIfnotExists(paths []string) error
CreateFilesInDirectories(directoryList []string, fileNames []string) error
GetMigrationFilesFromDirectory(directory string, database int) []string
GetMigrationsFromFiles(string, []string, string) (*[]SqlMigration, error)
RemoveFilesFromDirectories(directoryList []string, fileNames []string) error
}
type MigrationEntry ¶ added in v0.0.2
type MigratorConfig ¶ added in v0.0.2
type MigratorConfig struct {
Database int
Extention string
Migrator MigratorService
}
type MigratorService ¶ added in v0.0.2
type MigratorService interface {
// MigrateUp(0) will run all migrations
// MigrateUp(2) will run next 2 migrations
MigrateUp(int) error
// MigrateDown(0) will run all down migrations
// MigrateDown(2) will run next 2 migrations
MigrateDown(int) error
DeleteMigrationTable() error
GetMigrationEntries() (*[]MigrationEntry, error)
}
type SqlMigration ¶ added in v0.0.6
Click to show internal directories.
Click to hide internal directories.