migrate

package
v0.5.4 Latest Latest
Warning

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

Go to latest
Published: Jul 9, 2024 License: MIT Imports: 4 Imported by: 0

README

migrate

Package migrate implements the migration of data from one type of Keeper to another.

var (
	ErrNoStores = errors.New("no stores found in source keeper")
	ErrDupKeys  = errors.New(
		"duplicate keys found in destination stores, enable skipping or clobbering of existing data to continue migration",
	)
)
type ErrDuplicateKeys
type ErrDuplicateKeys struct {
	// map[store][]keys
	Duplicates map[string][][]byte
}
func NewDuplicateKeysErr
func NewDuplicateKeysErr(duplicates map[string][][]byte) *ErrDuplicateKeys
func (ErrDuplicateKeys) Error
func (e ErrDuplicateKeys) Error() string
func (ErrDuplicateKeys) Unwrap
func (e ErrDuplicateKeys) Unwrap() error
type Migrator
type Migrator struct {
	From database.Keeper
	To   database.Keeper
}
func NewMigrator
func NewMigrator(from, to database.Keeper) (*Migrator, error)
func (*Migrator) CheckDupes
func (m *Migrator) CheckDupes() error
func (*Migrator) Migrate
func (m *Migrator) Migrate() error
func (*Migrator) WithClobber
func (m *Migrator) WithClobber() *Migrator

WithClobber sets the clobber flag on the Migrator, allowing it to overwrite existing data in the destination Keeper.

func (*Migrator) WithSkipExisting
func (m *Migrator) WithSkipExisting() *Migrator

WithSkipExisting sets the skipExisting flag on the Migrator, allowing it to skip existing data in the destination Keeper.


Documentation

Overview

Package migrate implements the migration of data from one type of Keeper to another.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrNoStores = errors.New("no stores found in source keeper")
	ErrDupKeys  = errors.New(
		"duplicate keys found in destination stores, enable skipping or clobbering of existing data to continue migration",
	)
)

Functions

This section is empty.

Types

type ErrDuplicateKeys

type ErrDuplicateKeys struct {
	// map[store][]keys
	Duplicates map[string][][]byte
}

func NewDuplicateKeysErr

func NewDuplicateKeysErr(duplicates map[string][][]byte) *ErrDuplicateKeys

func (ErrDuplicateKeys) Error

func (e ErrDuplicateKeys) Error() string

func (ErrDuplicateKeys) Unwrap

func (e ErrDuplicateKeys) Unwrap() error

type Migrator

type Migrator struct {
	From database.Keeper
	To   database.Keeper
	// contains filtered or unexported fields
}

func NewMigrator

func NewMigrator(from, to database.Keeper) (*Migrator, error)

func (*Migrator) CheckDupes

func (m *Migrator) CheckDupes() error

func (*Migrator) Migrate

func (m *Migrator) Migrate() error

func (*Migrator) WithClobber

func (m *Migrator) WithClobber() *Migrator

WithClobber sets the clobber flag on the Migrator, allowing it to overwrite existing data in the destination Keeper.

func (*Migrator) WithSkipExisting

func (m *Migrator) WithSkipExisting() *Migrator

WithSkipExisting sets the skipExisting flag on the Migrator, allowing it to skip existing data in the destination Keeper.

Jump to

Keyboard shortcuts

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