Documentation ¶
Index ¶
- Variables
- func Apply(src []byte, m []Mapping) ([]byte, error)
- func Get(src []byte, ptrs []string) ([][]byte, error)
- type AppliedLensMap
- type Base64Lens
- type Jsonnet
- type Lens
- type LensMap
- type LineLens
- type Mapping
- type MultiYAMLLens
- type OCIImageRef
- type RegexpLens
- type Replacer
- type ReplacerTransformer
- type Setter
- type TOMLLens
- type YAMLLens
Constants ¶
This section is empty.
Variables ¶
var ( // Default is the default map of lenses. Default = LensMap{ "": YAMLLens{}, "yaml": YAMLLens{}, "yamls": MultiYAMLLens{}, "toml": TOMLLens{}, "base64": Base64Lens{}, "line": LineLens{}, "regexp": RegexpLens{}, "ociImageRef": OCIImageRef{}, "oci": OCIImageRef{}, "jsonnet": Jsonnet{}, } )
Functions ¶
Types ¶
type AppliedLensMap ¶
type AppliedLensMap struct {
// contains filtered or unexported fields
}
An AppliedLensMap is a Replacer that applied mappings to its inputs.
type Jsonnet ¶
type Jsonnet struct{}
Jsonnet implements the "jsonnet" lens.
The jsonnet lens implementation is still in its early stages, it only supports: 1. double quoted string scalars 2. single level ~{"foo":"bar", "baz":"quz"} matchers
type Lens ¶
A Lens knows how to perform in-place edits of parts of a text. The parts are addressed using JSONPointer pointers. The new value is provided via a transformer which allows, among other things, to nest lenses.
type LensMap ¶
A LensMap is a collection of named lenses.
func (LensMap) Apply ¶
Apply applies a slice of mappings on a source byte slice, resolving lens names from the lens map.
func (LensMap) ApplySetters ¶
ApplySetters applies a slice of setters on a source byte slice, resolving lens names from the lens map.
func (LensMap) Get ¶
Get returns a slice of byte slices, each one containing the value of a field addressed by a pointer.
func (LensMap) Replacer ¶
func (lm LensMap) Replacer(ms []Mapping) AppliedLensMap
Replacer returns a Replacer implementation that applies mappings to its input.
type LineLens ¶
type LineLens struct{}
LineLens implements the "line" lens. The line lens selects a line matching a regexp. Like awk's or sed's "/regexp/" construct.
type Mapping ¶
A Mapping is a request to replace the value pointed by pointer with a replacement string.
type OCIImageRef ¶
type OCIImageRef struct{}
OCIImageRef implements the "oci" lens. The current implementation is very rough and only supports image name and tag. The image name cannot contain a port number.
type RegexpLens ¶
type RegexpLens struct{}
RegexpLens implements the "regexp" lens. The regexp find a selection matching a regexp and exposes capturing groups as child nodes. Child nodes can be referenced by number or by name if the subexpressions is named with the naming syntax "(?P<name>re)").
type ReplacerTransformer ¶
type ReplacerTransformer struct {
// contains filtered or unexported fields
}
A ReplacerTransformer is a transform.Transformer that applies a Replacer.
func NewTransformer ¶
func NewTransformer(r Replacer) ReplacerTransformer
NewTransformer returns a transform.Transform implementation for a given replacer.
func (*ReplacerTransformer) Reset ¶
func (t *ReplacerTransformer) Reset()
Reset implements the golang.org/x/text/transform.Transformer interface.
type Setter ¶
A Setter is like a mapping but uses a Replacer to update the existing value pointed by the pointer.