yamlgenerator

package
v5.30.2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package yamlgenerator provides YAML generation functionality for arbitrary models.

This package implements a generic Generator for any Go struct, providing flexible YAML serialization with support for custom marshalling options.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Generator

type Generator[T any] struct {
	Marshaller marshaller.Marshaller[T]
}

Generator emits YAML for an arbitrary model using a provided marshaller.

func NewGenerator

func NewGenerator[T any]() *Generator[T]

NewGenerator creates a new Generator instance.

func (*Generator[T]) Generate

func (g *Generator[T]) Generate(model T, opts Options) (string, error)

Generate converts a model to YAML string format and optionally writes to file.

type Options

type Options struct {
	Output string // Output file path; if empty, only returns YAML without writing
	Force  bool   // Force overwrite existing files
}

Options defines options for YAML generators when emitting files.

Jump to

Keyboard shortcuts

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