configkit

package
v0.11.13 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 2 Imported by: 2 modules, 1 package

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RenderNative added in v0.11.12

func RenderNative(converter ConfigConverter, docs gaby.Container) ([]byte, error)

RenderNative renders documents in the native form. It may change the documents it is given, so a caller that keeps using them passes a copy.

func YAMLNativeToYAML added in v0.11.12

func YAMLNativeToYAML(data []byte) ([]byte, error)

YAMLNativeToYAML is NativeToYAML for a toolchain whose native form is YAML: it turns comments into $comment$ keys, so that comments read the same in every format. Data that does not parse is returned as it is, for the parse that follows to report.

func YAMLTreeToNative added in v0.11.12

func YAMLTreeToNative(docs gaby.Container) ([]byte, error)

YAMLTreeToNative is TreeToNative for a toolchain whose native form is YAML: it turns $comment$ keys back into YAML comments, in place, and renders the documents.

func YAMLYAMLToNative added in v0.11.12

func YAMLYAMLToNative(yamlData []byte) ([]byte, error)

YAMLYAMLToNative is YAMLToNative for a toolchain whose native form is YAML. Data that does not parse is returned as it is.

Types

type ConfigConverter

type ConfigConverter interface {
	NativeToYAML(data []byte) ([]byte, error)
	YAMLToNative(yamlData []byte) ([]byte, error)
	DataType() api.DataType
}

type TreeConverter added in v0.11.12

type TreeConverter interface {
	// TreeToNative renders documents in the native form. It may change the documents it is given.
	// For documents parsed from YAML this converter produced, it returns exactly what YAMLToNative
	// returns for their serialization.
	TreeToNative(docs gaby.Container) ([]byte, error)
}

TreeConverter is implemented by converters whose native form is YAML, so that converting is a change to the parsed documents -- moving comments between $comment$ keys and YAML's comment fields -- rather than a different syntax. TreeToNative renders parsed documents in the native form directly, where YAMLToNative serializes them, parses them again and then converts.

There is deliberately no method for the other direction yet. Parsing native data and moving its comments in place yields documents that render the same as converting the text and parsing the result, but not the same documents: serializing restyles some scalars (a plain nginx:2 in a flow mapping comes back single-quoted, non-ASCII text double-quoted, and comment values take the style the encoder chooses), and mutation records and getters render values from those styles.

Directories

Path Synopsis
Package cubkit is used to interpret ConfigHub/YAML configuration units.
Package cubkit is used to interpret ConfigHub/YAML configuration units.
yamlkit is a package for parsing, traversing, and updating lists of configuration elements, called resources, represented as yaml doc lists.
yamlkit is a package for parsing, traversing, and updating lists of configuration elements, called resources, represented as yaml doc lists.

Jump to

Keyboard shortcuts

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