header

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package header helps with marshaling and unmarshaling YAML structs together with header fields.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Fields

type Fields struct {
	// When marshaling, use NewStyleAPIVersion and not OldStyleAPIVersion.
	NewStyleAPIVersion model.String `yaml:"api_version,omitempty"`
	// OldStyleAPIVersion only exists to handle a legacy naming apiVersion; the
	// new, more correct name is "api_version".
	OldStyleAPIVersion model.String `yaml:"apiVersion,omitempty"`

	// One of "Template", "GoldenTest", etc.
	Kind model.String `yaml:"kind"`
}

Fields is the set of fields that are present in every "kind" of YAML file used in this program.

type With

type With[T any] struct {
	Header  *Fields `yaml:",inline"`
	Wrapped T       `yaml:",inline"`
}

With wraps any type in a struct that contains header fields. The header fields and payload fields are inlined together in the YAML output. This is intended to be used when marshaling a struct for output to a file, because our model structs don't have the "api_version" and "kind" fields.

Jump to

Keyboard shortcuts

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