migrate

package
v0.0.0-...-c36b137 Latest Latest
Warning

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

Go to latest
Published: Sep 13, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNotFound        = errors.New("migration not found")
	ErrInvalidToType   = errors.New("unexpected To type")
	ErrInvalidFromType = errors.New("unexpected From type")
)

Functions

func All

func All[From, To Versioned](migrations []Migration, from []From) ([]To, error)

func Each

func Each[From, To Versioned](migrations []Migration, from []From) iter.Seq2[To, error]

Types

type Error

type Error struct {
	Err     error
	Name    string
	Version uint
}

func (Error) Error

func (e Error) Error() string

func (Error) Unwrap

func (e Error) Unwrap() error

type Func

type Func[From, To Versioned] func(From) (To, error)

type IncrementVersion

type IncrementVersion interface {
	SetVersion(uint)
}

type Migration

type Migration interface {
	Migrate(Versioned) (any, error)
	Name() string
}

func NewMigration

func NewMigration[From, To Versioned](name string, migrate Func[From, To]) Migration

type Versioned

type Versioned interface {
	GetVersion() uint
}

Jump to

Keyboard shortcuts

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