actions

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Jun 2, 2021 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// Invalid overlay action.
	Invalid = iota
	// Merge overlay action.
	Merge
	// Replace overlay action.
	Replace
	// Delete overlay action.
	Delete
	// Combine overlay action.
	Combine
)
View Source
const (
	// Ignore onMissing action.
	Ignore = iota
	// Inject onMissing action.
	Inject
)
View Source
const (
	// ValueMarker is a format marker for the previous value.
	ValueMarker = `%v`
	// LineCommentMarker is a format marker for the previous line comment.
	LineCommentMarker = `%l`
	// HeadCommentMarker is a format marker for the previous head comment.
	HeadCommentMarker = `%h`
	// FootCommentMarker is a format marker for the previous foot comment.
	FootCommentMarker = `%f`
	// KeyMarker is a format marker for the previous key name.
	KeyMarker = `%k`
)

Variables

View Source
var (
	// ErrMergeMustBeOfSameKind occurs when attempting to merge two different types.
	ErrMergeMustBeOfSameKind = errors.New("both values must be of same type to use 'merge' action")
	// ErrMergeUnsupportedType occurs when an unsupported YAML type is attempted to be merged.
	ErrMergeUnsupportedType = errors.New("not a supported yaml type for merging")
)
View Source
var ErrCombineOnlyForScalars = errors.New("combine action can only be used on scalar values")

ErrCombineOnlyForScalars occurs when a non-scalar is attempted to be combined with a scalar value.

View Source
var ErrInvalidAction = errors.New("invalid overlay action")

ErrInvalidAction occurs when user passes a action that is not one of merge, replace, delete, combine.

Functions

func CombineNode

func CombineNode(originalValue, newValue *yaml.Node) error

func DeleteNode

func DeleteNode(pn, child *yaml.Node)

func MergeNode

func MergeNode(nodes ...*yaml.Node) error

func ReplaceNode

func ReplaceNode(original, replace *yaml.Node) error

func SetStyle

func SetStyle(ss Styles, n ...*yaml.Node)

Types

type Action

type Action int

func (Action) MarshalYAML

func (a Action) MarshalYAML() (interface{}, error)

func (Action) String

func (a Action) String() string

func (*Action) UnmarshalYAML

func (a *Action) UnmarshalYAML(value *yaml.Node) error

type OnMissingAction

type OnMissingAction int

func (OnMissingAction) MarshalYAML

func (a OnMissingAction) MarshalYAML() (interface{}, error)

func (OnMissingAction) String

func (a OnMissingAction) String() string

func (*OnMissingAction) UnmarshalYAML

func (a *OnMissingAction) UnmarshalYAML(value *yaml.Node) error

type Style

type Style uint
const (
	// TaggedStyle chooses YAML Tag style for rendering.
	TaggedStyle Style = 1 << iota
	// DoubleQuotedStyle chooses YAML Double Quoted style for rendering.
	DoubleQuotedStyle
	// SingleQuotedStyle chooses YAML Single Quoted style for rendering.
	SingleQuotedStyle
	// LiteralStyle chooses use YAML Literal style for rendering.
	LiteralStyle
	// FoldedStyle chooses use YAML Folded style for rendering.
	FoldedStyle
	// FlowStyle chooses YAML Flow style for rendering.
	FlowStyle
	// NormalStyle chooses YAML Normal style for rendering.
	NormalStyle
)

func (Style) String

func (s Style) String() string

type Styles

type Styles []Style

func (Styles) FlagMap

func (ss Styles) FlagMap() map[Style][]string

func (Styles) GetStyle

func (ss Styles) GetStyle() Style

Jump to

Keyboard shortcuts

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