migration

package
v0.32.0 Latest Latest
Warning

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

Go to latest
Published: Jun 16, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package migration helps with migrating deprecated config options.

`panic` is only used for programmer errors, meaning they will only trigger during development.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Migrate

func Migrate(logger *logrus.Entry, optPrefix string, deprecated any, newOptions map[string]Migrator) bool

Migrate checks each field of `deprecated` to see if a migration can and should be run.

Each field must be a pointer: this allows knowing if the user has set a value in the config.

Types

type Dest

type Dest struct {
	Value   reflect.Value
	Default any
	// contains filtered or unexported fields
}

func To

func To[T any](newName string, newContainerStruct *T) *Dest

To creates a new `Dest` from an option name (relative to the `Migrate` prefix) and the struct containing that option.

func (*Dest) IsDefault

func (d *Dest) IsDefault() bool

func (*Dest) Name

func (d *Dest) Name() string

func (*Dest) String

func (d *Dest) String() string

type Migrator

type Migrator struct {
	// contains filtered or unexported fields
}

func Apply

func Apply[T any](dest *Dest, apply func(oldValue T)) Migrator

Apply calls `apply` with the deprecated value casted to `T`.

func Move

func Move(dest *Dest) Migrator

Move copies the deprecated option's value to `dest`.

Jump to

Keyboard shortcuts

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