migrationlib

package
v0.1.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 21, 2021 License: Apache-2.0 Imports: 8 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Command

type Command interface {
	Up() error
	UpTo(limit uint) error
	Down() error
	DownTo(limit int) error
	Drop() error

	GoTo(version uint) error
	Force(version uint) error
	CurrentVersion() (uint, bool, error)
	PrintUsageInfo()
}

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

type SourceDriver

type SourceDriver string
const (
	FileDriver SourceDriver = "file"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL