yml

package
v0.0.4 Latest Latest
Warning

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

Go to latest
Published: Oct 4, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ContextWithConfig

func ContextWithConfig(ctx context.Context, config *Config) context.Context

func CreateOrUpdateKeyNode

func CreateOrUpdateKeyNode(ctx context.Context, key string, keyNode *yaml.Node) *yaml.Node

func CreateOrUpdateMapNodeElement

func CreateOrUpdateMapNodeElement(ctx context.Context, key string, keyNode, valueNode, mapNode *yaml.Node) *yaml.Node

func CreateOrUpdateScalarNode

func CreateOrUpdateScalarNode(ctx context.Context, value any, valueNode *yaml.Node) *yaml.Node

func CreateOrUpdateSliceNode

func CreateOrUpdateSliceNode(ctx context.Context, elements []*yaml.Node, valueNode *yaml.Node) *yaml.Node

func DeleteMapNodeElement

func DeleteMapNodeElement(ctx context.Context, key string, mapNode *yaml.Node) *yaml.Node

func GetMapElementNodes

func GetMapElementNodes(ctx context.Context, mapNode *yaml.Node, key string) (*yaml.Node, *yaml.Node, bool)

Types

type Config

type Config struct {
	KeyStringStyle   yaml.Style   // The default string style to use when creating new keys
	ValueStringStyle yaml.Style   // The default string style to use when creating new nodes
	Indentation      int          // The indentation level of the document
	OutputFormat     OutputFormat // The output format to use when marshalling
}

func GetConfigFromContext

func GetConfigFromContext(ctx context.Context) *Config

func GetConfigFromDoc

func GetConfigFromDoc(data []byte, doc *yaml.Node) *Config

type OutputFormat

type OutputFormat string
const (
	OutputFormatJSON OutputFormat = "json"
	OutputFormatYAML OutputFormat = "yaml"
)

Jump to

Keyboard shortcuts

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