Help us shape the future of Go! Take the 2026 Go Developer Survey

migration

package
v0.10.4 Latest Latest
Warning

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

Go to latest
Published: Sep 12, 2022 License: MPL-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type CheckFunc

type CheckFunc func(context.Context, *sql.Tx) (Problems, error)

CheckFunc is a function that checks the state of data in the database to determine if a migration will fail, and if so to report the data that is problematic so it can be fixed.

type Hook

type Hook struct {
	CheckFunc  CheckFunc
	RepairFunc RepairFunc

	// RepairDescription will describe what change running the repair function
	// would perform.
	RepairDescription string
}

Hook provides a set of functions that allow for executing checks prior to executing migration statements.

type Migration

type Migration struct {
	Statements []byte
	Edition    string
	Version    int
	PreHook    *Hook
}

Migration is a set of statements that will alter the database structure or or data.

type Migrations

type Migrations map[int]Migration

Migrations are a set of migrations by version.

type Problems

type Problems []string

Problems are reports of data issues that were identified by a CheckFunc.

type RepairFunc

type RepairFunc func(context.Context, *sql.Tx) (Repairs, error)

RepairFunc is a function that alters data in the database to resolve issues that would prevent a migration from successfully running.

type Repairs

type Repairs []string

Repairs are reports of changes made to data by a RepairFunc.

Jump to

Keyboard shortcuts

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