migrator

package
v1.6.0 Latest Latest
Warning

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

Go to latest
Published: Nov 16, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrateFrom

func MigrateFrom(ctx context.Context, fromVersion string) error

func RegisterMigrator

func RegisterMigrator(fromVersion string, toVersion string, migrator NewMigrator)

Types

type AppyFn

type AppyFn func(ctx context.Context) error

type Migration

type Migration struct {
	PBar *progressbar.ProgressBar
	// contains filtered or unexported fields
}

Migration base migrator struct

func NewMigration

func NewMigration(fromVersion string, toVersion string, ctx context.Context) *Migration

func (*Migration) Apply

func (m *Migration) Apply() error

func (*Migration) CanMigrate

func (m *Migration) CanMigrate() bool

func (*Migration) FromVersion

func (m *Migration) FromVersion() string

func (*Migration) Migrate

func (m *Migration) Migrate(applyFn AppyFn) error

Migrate wrapper structs call this function to reduce boilerplate code that's needed for a migration

func (*Migration) ToVersion

func (m *Migration) ToVersion() string

type MigrationOption

type MigrationOption func() Migrator

type Migrator

type Migrator interface {
	Apply() error
	CanMigrate() bool
	FromVersion() string
	ToVersion() string
}

func GetMigratorByFromVersion

func GetMigratorByFromVersion(ctx context.Context, fromVersion string) Migrator

type NewMigrator

type NewMigrator func(ctx context.Context) Migrator

func GetMigratorFactory

func GetMigratorFactory(fromVersion string, toVersion string) NewMigrator

Jump to

Keyboard shortcuts

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