output

package
v0.0.78 Latest Latest
Warning

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

Go to latest
Published: Jun 3, 2021 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ToYaml

func ToYaml(root Root, out io.Writer, tabsize int, commentDefaults, excludeDefaults bool)

ToYaml create a yaml output of the configuration. Tab size, comment out default values, or exclude default values are configurable options.

Types

type Attribute

type Attribute struct {
	FullName          string
	IsDefault         bool
	AdditionalComment string
	Value             interface{}
}

Attribute contains setting of a single value.

func (Attribute) ShortName

func (a Attribute) ShortName() string

ShortName of an attributes FullName split by ".".

type Element

type Element struct {
	FullName   string
	Attributes []Attribute
	Elements   []Element
}

Element groups settings and child groups of settings.

func (Element) IsDefault

func (e Element) IsDefault() bool

IsDefault checks the entire Element and child Elements and Attributes to deterimine if all values are default.

func (Element) ShortName

func (e Element) ShortName() string

ShortName of the element split by ".".

func (Element) SortedAttributes

func (e Element) SortedAttributes() []Attribute

SortedAttributes to ensure that `[]Attribute` slice is sorted consistently.

func (Element) SortedElements

func (e Element) SortedElements() []Element

SortedElements to ensure that `[]Element` slice is sorted consistently.

type Root

type Root struct {
	Elements []Element
}

Root element for that contains only `[]Element` structs.

Jump to

Keyboard shortcuts

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