Documentation
¶
Overview ¶
Package migrationlib is for encapsulating github.com/golang-migrate/migrate any operations
As a quick start:
migrationlib.NewMigrateLib(migrationlib.Config{
DatabaseDriver: migrationlib.PostgresDriver,
DatabaseURL: "postgres://postgres:postgres@localhost:5432/migrationlib?sslmode=disable",
SourceDriver: migrationlib.FileDriver,
SourceURL: "file://migrations",
TableName: "migration_versions",
}).Up()
Index ¶
- type Command
- type Config
- type DatabaseDriver
- type MigrateCommand
- func (m MigrateCommand) CurrentVersion() (uint, bool, error)
- func (m MigrateCommand) Down() error
- func (m MigrateCommand) DownTo(limit int) error
- func (m MigrateCommand) Drop() error
- func (m MigrateCommand) Force(version uint) error
- func (m MigrateCommand) GoTo(version uint) error
- func (m MigrateCommand) PrintUsageInfo()
- func (m MigrateCommand) Up() error
- func (m MigrateCommand) UpTo(limit uint) error
- type MigrationLib
- type SourceDriver
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
DatabaseDriver DatabaseDriver
DatabaseURL string
SourceDriver SourceDriver
SourceURL string
TableName string
}
type DatabaseDriver ¶
type DatabaseDriver string
const (
PostgresDriver DatabaseDriver = "postgres"
)
type MigrateCommand ¶
type MigrateCommand struct {
// contains filtered or unexported fields
}
func (MigrateCommand) CurrentVersion ¶
func (m MigrateCommand) CurrentVersion() (uint, bool, error)
func (MigrateCommand) Down ¶
func (m MigrateCommand) Down() error
func (MigrateCommand) DownTo ¶
func (m MigrateCommand) DownTo(limit int) error
func (MigrateCommand) Drop ¶
func (m MigrateCommand) Drop() error
func (MigrateCommand) Force ¶
func (m MigrateCommand) Force(version uint) error
func (MigrateCommand) GoTo ¶
func (m MigrateCommand) GoTo(version uint) error
func (MigrateCommand) PrintUsageInfo ¶
func (m MigrateCommand) PrintUsageInfo()
func (MigrateCommand) Up ¶
func (m MigrateCommand) Up() error
func (MigrateCommand) UpTo ¶
func (m MigrateCommand) UpTo(limit uint) error
type MigrationLib ¶
type MigrationLib interface {
Command
}
func NewMigrateLib ¶
func NewMigrateLib(c Config) MigrationLib
Click to show internal directories.
Click to hide internal directories.