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
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
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
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 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. |