Documentation
¶
Index ¶
- Constants
- func ContextWithConfig(ctx context.Context, config *Config) context.Context
- func CreateMapNode(ctx context.Context, content []*yaml.Node) *yaml.Node
- func CreateOrUpdateKeyNode(ctx context.Context, key string, keyNode *yaml.Node) *yaml.Node
- func CreateOrUpdateMapNodeElement(ctx context.Context, key string, keyNode, valueNode, mapNode *yaml.Node) *yaml.Node
- func CreateOrUpdateScalarNode(ctx context.Context, value any, valueNode *yaml.Node) *yaml.Node
- func CreateOrUpdateSliceNode(ctx context.Context, elements []*yaml.Node, valueNode *yaml.Node) *yaml.Node
- func DeleteMapNodeElement(ctx context.Context, key string, mapNode *yaml.Node) *yaml.Node
- func GetMapElementNodes(ctx context.Context, mapNode *yaml.Node, key string) (*yaml.Node, *yaml.Node, bool)
- func NodeKindToString(kind yaml.Kind) string
- func ResolveAlias(node *yaml.Node) *yaml.Node
- func Walk(ctx context.Context, node *yaml.Node, visit VisitFunc) error
- type Config
- type OutputFormat
- type VisitFunc
Constants ¶
View Source
const ( // ErrTerminate is a sentinel error that can be returned from a Walk function to terminate the walk. ErrTerminate = errors.Error("terminate") )
Variables ¶
This section is empty.
Functions ¶
func ContextWithConfig ¶
func CreateMapNode ¶ added in v0.2.1
func CreateOrUpdateKeyNode ¶
func CreateOrUpdateSliceNode ¶
func DeleteMapNodeElement ¶
func GetMapElementNodes ¶
func NodeKindToString ¶ added in v0.2.2
NodeKindToString returns a human-readable string representation of a yaml.Kind. This helper function is useful for creating more user-friendly error messages when dealing with YAML node kinds in error reporting.
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
OriginalFormat OutputFormat // The original input format, helps detect when we are changing formats
}
func GetConfigFromContext ¶
type OutputFormat ¶
type OutputFormat string
const ( OutputFormatJSON OutputFormat = "json" OutputFormatYAML OutputFormat = "yaml" )
Click to show internal directories.
Click to hide internal directories.