lib

package
v0.0.0-...-f6ed139 Latest Latest
Warning

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

Go to latest
Published: Jan 12, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// MigrationTypeUp represents "up" migrations
	MigrationTypeUp = "up"
	// MigrationTypeDown represents "down" migrations
	MigrationTypeDown = "down"
	// MigrationTypeAlways represents "always" migrations
	MigrationTypeAlways = "always"
)
View Source
const AlwaysSuffix = ".always.sql"

AlwaysSuffix is the suffix for always migrations

View Source
const DownSuffix = ".down.sql"

DownSuffix is the suffix for down migrations

View Source
const UpSuffix = ".up.sql"

UpSuffix is the suffix for up migrations

Variables

This section is empty.

Functions

This section is empty.

Types

type ByVersion

type ByVersion []MigrationFile

ByVersion is a type used for sorting files by version in ascending order

func (ByVersion) Len

func (a ByVersion) Len() int

func (ByVersion) Less

func (a ByVersion) Less(i, j int) bool

func (ByVersion) Swap

func (a ByVersion) Swap(i, j int)

type Configuration

type Configuration struct {
	Engine         string
	Folders        []string
	ConnectionFile string
}

Configuration is a holder for various configuration data

func NewConfiguration

func NewConfiguration(engine, connectionFile string) Configuration

NewConfiguration builds a default configuration

func NewConfigurationFromFile

func NewConfigurationFromFile(name string) (Configuration, error)

NewConfigurationFromFile parses a Toml file to build a Configuration

func (Configuration) ConnectionString

func (c Configuration) ConnectionString() (string, error)

type MigrationFile

type MigrationFile struct {
	Dirname     string
	Filename    string
	Version     string
	Description string
	Type        MigrationType
}

MigrationFile represents the parsed data from an indiviual migration file

func GatherFiles

func GatherFiles(dirs []string, suffixes []string) ([]MigrationFile, error)

GatherFiles files in the directories supplied and returns an array of MigrationFile values if the files match any of the suffixes provided

func (MigrationFile) Contents

func (f MigrationFile) Contents() (string, error)

Contents reads then entire contents of the MigrationFile

type MigrationType

type MigrationType string

MigrationType is used to contain types of migrations (up, down, always, invalid)

type Steps

type Steps struct {
	// contains filtered or unexported fields
}

Steps helps output nice messages

func NewSteps

func NewSteps() Steps

NewSteps builds a new Steps instance

func (Steps) Done

func (s Steps) Done()

Done outputs the end of an entry in the table with a status of DONE

func (Steps) Error

func (s Steps) Error()

Error outputs the end of an entry in the table with a status of ERROR

func (Steps) Fail

func (s Steps) Fail()

Fail outputs the end of an entry in the table with a status of FAIL

func (Steps) PrintHeader

func (s Steps) PrintHeader()

PrintHeader outputs the table header

func (Steps) PrintRule

func (Steps) PrintRule()

PrintRule outputs a horizontal rule

func (Steps) Start

func (s Steps) Start(title string)

Start outputs the start of an entry in the table

func (Steps) Success

func (s Steps) Success()

Success outputs the end of an entry in the table with a status of SUCCESS

Jump to

Keyboard shortcuts

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