migration

package
v0.5.0 Latest Latest
Warning

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

Go to latest
Published: Oct 22, 2022 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

View Source
const SHMigSplit = "-- ==== DOWN ===="

Variables

View Source
var (
	ListTFType = tftypes.List{
		ElementType: ValueTFType,
	}
	ValueTFType = tftypes.Object{
		AttributeTypes: map[string]tftypes.Type{
			"id":   tftypes.String,
			"up":   tftypes.String,
			"down": tftypes.String,
		},
	}
)

Functions

func Down

func Down(ctx context.Context, db SQLExecer, all, applied []Migration) error

func List

func List(migrations []Migration) tftypes.Value

func Up

func Up(ctx context.Context, db SQLExecer, all, applied []Migration) error

Types

type Migration

type Migration struct {
	ID   string
	Up   string
	Down string
}

func FromListValue

func FromListValue(v tftypes.Value) ([]Migration, error)

func FromValue

func FromValue(v tftypes.Value) (Migration, error)

func ReadDir

func ReadDir(dir string, opts *Options) ([]Migration, error)

func Subtract

func Subtract(x, y []Migration) []Migration

func (Migration) Value

func (m Migration) Value() tftypes.Value

type Options

type Options struct {
	StripLineComments bool
	SingleFileSplit   string
}

type SQLExecer added in v0.4.0

type SQLExecer interface {
	ExecContext(ctx context.Context, query string, args ...interface{}) (sql.Result, error)
}

Jump to

Keyboard shortcuts

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