migrate

package
v0.118.0 Latest Latest
Warning

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

Go to latest
Published: Jan 21, 2025 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Package migrate provides the functionality to take action on specific schema fields that are consumed by the translation package.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AttributeChangeSet

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

AttributeChangeSet represents a rename_attributes type operation. The listed changes are duplicated twice to allow for simplified means of transition to or from a revision.

func NewAttributeChangeSet

func NewAttributeChangeSet(mappings ast.AttributeMap) AttributeChangeSet

NewAttributeChangeSet allows for typed strings to be used as part of the invocation that will be converted into the default string type.

func (*AttributeChangeSet) Do added in v0.115.0

func (a *AttributeChangeSet) Do(ss StateSelector, attrs pcommon.Map) (errs error)

func (AttributeChangeSet) IsMigrator added in v0.115.0

func (a AttributeChangeSet) IsMigrator()

type ConditionalAttributeSet

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

ConditionalAttributeSet represents a rename_attribute that will happen only if the passed in value matches the `on` set.

func NewConditionalAttributeSet

func NewConditionalAttributeSet[Match ValueMatch](mappings ast.AttributeMap, matches ...Match) ConditionalAttributeSet

func (*ConditionalAttributeSet) Do added in v0.115.0

func (ca *ConditionalAttributeSet) Do(ss StateSelector, attrs pcommon.Map, values ...string) (errs error)

Do applies the attribute changes specified in the constructor if any of the values in values matches the matches specified in the constructor.

func (ConditionalAttributeSet) IsMigrator added in v0.115.0

func (ca ConditionalAttributeSet) IsMigrator()

type ConditionalAttributeSetSlice

type ConditionalAttributeSetSlice []*ConditionalAttributeSet

type Migrator added in v0.115.0

type Migrator interface {
	IsMigrator()
}

Migrator is an interface that all migration types must implement. It is basically a marker interface. All Transformers are also Migrators

type MultiConditionalAttributeSet added in v0.115.0

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

MultiConditionalAttributeSet maps from string keys to possible values for each of those keys. The Do function then checks passed in values for each key against the list provided here in the constructor. If there is a matching value for each key, the attribute changes are applied.

func NewMultiConditionalAttributeSet added in v0.115.0

func NewMultiConditionalAttributeSet[Match ValueMatch](mappings ast.AttributeMap, matches map[string][]Match) MultiConditionalAttributeSet

func (*MultiConditionalAttributeSet) Do added in v0.115.0

func (ca *MultiConditionalAttributeSet) Do(ss StateSelector, attrs pcommon.Map, keyToCheckVals map[string]string) (errs error)

Do function applies the attribute changes if the passed in values match the expected values provided in the constructor. Uses the Do method of the embedded AttributeChangeSet

func (MultiConditionalAttributeSet) IsMigrator added in v0.115.0

func (ca MultiConditionalAttributeSet) IsMigrator()

type MultiConditionalAttributeSetSlice added in v0.115.0

type MultiConditionalAttributeSetSlice []*MultiConditionalAttributeSet

type SignalNameChange

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

SignalNameChange allows for migrating types that implement the `alias.NamedSignal` interface.

func NewSignalNameChange

func NewSignalNameChange[Key SignalType, Value SignalType](mappings map[Key]Value) SignalNameChange

NewSignalNameChange will create a `Signal` that will check the provided mappings if it can update a `alias.NamedSignal` and if no values are provided for `matches`, then all values will be updated.

func (*SignalNameChange) Do added in v0.115.0

func (s *SignalNameChange) Do(ss StateSelector, signal alias.NamedSignal)

func (SignalNameChange) IsMigrator added in v0.115.0

func (s SignalNameChange) IsMigrator()

type SignalType

type SignalType interface {
	~string
}

SignalType allows for type constraints in order to apply to potential type defined strings.

type StateSelector

type StateSelector int
const (
	StateSelectorApply StateSelector
	StateSelectorRollback
)

type ValueMatch

type ValueMatch interface {
	~string
}

ValueMatch defines the expected match type that is used on creation of `ConditionalAttributeSet`

Jump to

Keyboard shortcuts

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