migrate

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Mar 25, 2026 License: GPL-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

Overview

Package migrate provides protocol version migration tools.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GenerateScript

func GenerateScript(plan *MigrationPlan) string

GenerateScript generates a migration script from a plan.

func Validate

func Validate(plan *MigrationPlan, data map[string]interface{}) error

Validate validates data against the target version after migration.

Types

type MigrationPlan

type MigrationPlan struct {
	Protocol    string          `json:"protocol"`
	FromVersion string          `json:"from_version"`
	ToVersion   string          `json:"to_version"`
	Steps       []MigrationStep `json:"steps"`
	Reversible  bool            `json:"reversible"`
}

MigrationPlan describes how to migrate between protocol versions.

func GeneratePlan

func GeneratePlan(protocol, fromVer, toVer string) *MigrationPlan

GeneratePlan generates a migration plan between two protocol versions.

func Rollback

func Rollback(plan *MigrationPlan) *MigrationPlan

Rollback generates a rollback plan from an existing migration plan.

type MigrationStep

type MigrationStep struct {
	Type        string `json:"type"` // add, remove, rename, change_type
	Field       string `json:"field"`
	NewField    string `json:"new_field,omitempty"`
	NewType     string `json:"new_type,omitempty"`
	Description string `json:"description"`
}

MigrationStep represents a single migration operation.

Jump to

Keyboard shortcuts

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