yamlwriter

package
v0.3.0 Latest Latest
Warning

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

Go to latest
Published: Mar 31, 2026 License: Apache-2.0 Imports: 6 Imported by: 0

Documentation

Overview

Copyright 2026 YLD Limited SPDX-License-Identifier: Apache-2.0 Package yamlwriter marshals Go structs into YAML, with special handling for cty.Value fields. It converts cty values through the go-cty-yaml serializer before producing the final YAML output.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Convert

func Convert[T any](input T) (any, error)

Convert transforms a typed value into a plain any suitable for YAML marshaling.

func Marshal

func Marshal[T any](input T) ([]byte, error)

Marshal converts input to an intermediate representation and then marshals it to YAML bytes.

Types

type Updater

type Updater interface {
	GetFilename() string
	Validation() error
	PostChanges([]byte) []byte
}

Updater is implemented by types that can provide a filename, validate, and post-process YAML output.

type Writer

type Writer[T Updater] struct {
	// contains filtered or unexported fields
}

Writer marshals a collection of Updater values into named YAML files.

func New

func New[T Updater](content []T) *Writer[T]

New returns a Writer that will process the given content items.

func (*Writer[T]) Do

func (config *Writer[T]) Do() (map[string][]byte, error)

Do validates, marshals, and post-processes each item, returning a map of filename to YAML bytes.

Jump to

Keyboard shortcuts

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