configupgrade

package
v0.14.0 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2023 License: MPL-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

View Source
const (
	NullTag      = "!!null"
	BoolTag      = "!!bool"
	StrTag       = "!!str"
	IntTag       = "!!int"
	FloatTag     = "!!float"
	TimestampTag = "!!timestamp"
	SeqTag       = "!!seq"
	MapTag       = "!!map"
	BinaryTag    = "!!binary"
)

Variables

This section is empty.

Functions

func Do

func Do(configPath string, save bool, upgrader BaseUpgrader, additional ...Upgrader) ([]byte, bool, error)

Types

type BaseUpgrader

type BaseUpgrader interface {
	Upgrader
	GetBase() string
}

type Helper

type Helper struct {
	Base   YAMLNode
	Config YAMLNode
}

func NewHelper

func NewHelper(base, cfg *yaml.Node) *Helper

func (*Helper) AddSpaceBeforeComment

func (helper *Helper) AddSpaceBeforeComment(path ...string)

func (*Helper) Copy

func (helper *Helper) Copy(allowedTypes YAMLType, path ...string)

func (*Helper) Get

func (helper *Helper) Get(tag YAMLType, path ...string) (string, bool)

func (*Helper) GetBase

func (helper *Helper) GetBase(path ...string) string

func (*Helper) GetBaseNode

func (helper *Helper) GetBaseNode(path ...string) *YAMLNode

func (*Helper) GetNode

func (helper *Helper) GetNode(path ...string) *YAMLNode

func (*Helper) Set

func (helper *Helper) Set(tag YAMLType, value string, path ...string)

func (*Helper) SetMap

func (helper *Helper) SetMap(value YAMLMap, path ...string)

type SimpleUpgrader

type SimpleUpgrader func(helper *Helper)

func (SimpleUpgrader) DoUpgrade

func (su SimpleUpgrader) DoUpgrade(helper *Helper)

type SpacedUpgrader

type SpacedUpgrader interface {
	Upgrader
	SpacedBlocks() [][]string
}

type StructUpgrader

type StructUpgrader struct {
	SimpleUpgrader
	Blocks [][]string
	Base   string
}

func (*StructUpgrader) GetBase

func (su *StructUpgrader) GetBase() string

func (*StructUpgrader) SpacedBlocks

func (su *StructUpgrader) SpacedBlocks() [][]string

type Upgrader

type Upgrader interface {
	DoUpgrade(helper *Helper)
}

type YAMLList

type YAMLList []YAMLNode

type YAMLMap

type YAMLMap map[string]YAMLNode

type YAMLNode

type YAMLNode struct {
	*yaml.Node
	Map  YAMLMap
	List YAMLList
	Key  *yaml.Node
}

func StringNode

func StringNode(val string) YAMLNode

func (*YAMLNode) UpdateContent

func (yn *YAMLNode) UpdateContent()

type YAMLType

type YAMLType uint32
const (
	Null YAMLType = 1 << iota
	Bool
	Str
	Int
	Float
	Timestamp
	List
	Map
	Binary
)

func (YAMLType) String

func (t YAMLType) String() string

Jump to

Keyboard shortcuts

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