migration

package
v0.0.0-...-b383557 Latest Latest
Warning

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

Go to latest
Published: Jun 23, 2020 License: Apache-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Migration

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

Migration ...

func LoadAllLaterThan

func LoadAllLaterThan(version int64, dirname string) ([]Migration, error)

LoadAllLaterThan ...

func (*Migration) DownSQL

func (m *Migration) DownSQL() string

DownSQL returns SQL for a "down" migration.

func (*Migration) LeadingComment

func (m *Migration) LeadingComment() string

LeadingComment returns the migration leading comment

func (*Migration) Name

func (m *Migration) Name() string

Name returns the migration name.

func (*Migration) ReadFromFile

func (m *Migration) ReadFromFile(path string) error

ReadFromFile creates a migration file in the directory specified by "dir" and writes content to it based on this migration's fields.

func (*Migration) SQL

func (m *Migration) SQL() string

SQL returns the migration SQL including leading comment, up SQL and down SQL.

func (*Migration) SetDownSQL

func (m *Migration) SetDownSQL(sql string)

SetDownSQL sets SQL for a "down" migration.

func (*Migration) SetLeadingComment

func (m *Migration) SetLeadingComment(comment string)

SetLeadingComment sets the migration leading comment after sanitizng comment and prefixing it with "-- ".

func (*Migration) SetName

func (m *Migration) SetName(name string)

SetName sets migration name after converting name string to snake_case.

func (*Migration) SetUpSQL

func (m *Migration) SetUpSQL(sql string)

SetUpSQL sets SQL for an "up" migration.

func (*Migration) SetVersion

func (m *Migration) SetVersion(ver int64)

SetVersion sets version.

func (*Migration) UpSQL

func (m *Migration) UpSQL() string

UpSQL returns SQL for an "up" migration.

func (*Migration) Version

func (m *Migration) Version() int64

Version returns version.

func (*Migration) WriteToFile

func (m *Migration) WriteToFile(dirname string) (string, error)

WriteToFile creates a migration file in the directory specified by "dir" and writes content to it based on this migration's fields.

Jump to

Keyboard shortcuts

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