migrations

package
v0.12.0 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2025 License: MIT Imports: 0 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Migration1_0To2_0

type Migration1_0To2_0 struct{}

Migration1_0To2_0 migrates export data from version 1.0 to 2.0.

This is an example migration that demonstrates the migration pattern. In a real scenario, this would transform data structures, add new fields, or rename existing fields as needed for the new version.

Changes in 2.0:

  • Add metadata field with migration information
  • Add migrated_from field to track migration history

Thread Safety:

Safe to call concurrently.

Example:

migration := &Migration1_0To2_0{}
migrated, err := migration.Migrate(oldData)
if err != nil {
    log.Printf("Migration failed: %v", err)
}

func (*Migration1_0To2_0) From

func (m *Migration1_0To2_0) From() string

From returns the source version this migration applies to.

func (*Migration1_0To2_0) Migrate

func (m *Migration1_0To2_0) Migrate(data map[string]interface{}) (map[string]interface{}, error)

Migrate transforms data from version 1.0 to 2.0.

This migration adds metadata to track the migration history. The original data is preserved and new fields are added.

Parameters:

  • data: The export data in version 1.0 format

Returns:

  • map[string]interface{}: The migrated data in version 2.0 format
  • error: nil on success, error if migration fails

func (*Migration1_0To2_0) To

func (m *Migration1_0To2_0) To() string

To returns the target version this migration produces.

Jump to

Keyboard shortcuts

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