migrations

package
v2.2.4-rc1+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 29, 2021 License: AGPL-3.0 Imports: 2 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Apply

func Apply(ctx context.Context, current *version.Version, target *version.Version, migrations []*Migration) (*version.Version, error)

ApplyMigrations browse migrations upward on downward and apply them sequentially. It returns a version to be saved as the current valid version of the service, or nil if no changes were necessary. In specific case where current version is 0.0.0 (first run), it only applies first run migration (if any) and returns target version.

func FirstRun

func FirstRun() *version.Version

FirstRun returns version "zero".

Types

type Migration

type Migration struct {
	TargetVersion *version.Version
	Up            func(ctx context.Context) error
	Down          func(ctx context.Context) error
}

Migration defines a target version and functions to upgrade and/or downgrade.

Jump to

Keyboard shortcuts

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