Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Container ¶
type Container interface { Get(key string) (*Node, error) Set(key string, val *Node) error Add(key string, val *Node) error Remove(key string) error }
Container is the interface for performing operations on Nodes
type Node ¶
type Node struct {
// contains filtered or unexported fields
}
Node holds a YAML document that has not yet been processed into a NodeMap or NodeSlice
func NewNode ¶
func NewNode(raw *interface{}) *Node
NewNode returns a new Node. It expects a pointer to an interface{}
func (*Node) Equal ¶ added in v0.0.6
Equal compares the values of the raw interfaces that the YAML was unmarshaled into
func (*Node) MarshalYAML ¶
MarshalYAML implements yaml.Marshaler, and returns the correct interface{} to be marshaled
func (*Node) UnmarshalYAML ¶
UnmarshalYAML implements yaml.Unmarshaler
type OpPath ¶
type OpPath string
OpPath is an RFC6902 'pointer'
func (*OpPath) ContainsExtendedSyntax ¶
ContainsExtendedSyntax returns whether the OpPath uses the "key=value" format, as in "/foo/name=bar", where /foo points at an array that contains an object with a key "name" that has a value "bar"
type Operation ¶
type Operation struct { Op Op `yaml:"op,omitempty"` Path OpPath `yaml:"path,omitempty"` From OpPath `yaml:"from,omitempty"` Value *Node `yaml:"value,omitempty"` }
Operation is an RFC6902 'Operation' https://tools.ietf.org/html/rfc6902#section-4
type Patch ¶
type Patch []Operation
Patch is an ordered collection of operations.
func DecodePatch ¶
DecodePatch decodes the passed YAML document as if it were an RFC 6902 patch
type PathFinder ¶ added in v0.0.4
type PathFinder struct {
// contains filtered or unexported fields
}
PathFinder can be used to find RFC6902-standard paths given non-standard (key=value) pointer syntax
func NewPathFinder ¶ added in v0.0.4
func NewPathFinder(container Container) *PathFinder
NewPathFinder takes an interface that represents a YAML document and returns a new PathFinder
func (*PathFinder) Find ¶ added in v0.0.4
func (p *PathFinder) Find(path string) []string
Find expands the given path into all matching paths, returning the canonical versions of those matching paths
type PlaceholderWrapper ¶ added in v0.0.3
type PlaceholderWrapper struct { LeftSide string RightSide string // contains filtered or unexported fields }
PlaceholderWrapper can be used to wrap placeholders that make YAML invalid in single quotes to make otherwise valid YAML
func NewPlaceholderWrapper ¶ added in v0.0.3
func NewPlaceholderWrapper(left, right string) *PlaceholderWrapper
NewPlaceholderWrapper returns a new PlaceholderWrapper which knows how to wrap and unwrap the provided left and right sides of a placeholder, e.g. {{ and }}
func (*PlaceholderWrapper) Unwrap ¶ added in v0.0.3
func (w *PlaceholderWrapper) Unwrap(input []byte) []byte
Unwrap the single quotes from the placeholder to make it invalid YAML (again)
func (*PlaceholderWrapper) Wrap ¶ added in v0.0.3
func (w *PlaceholderWrapper) Wrap(input []byte) []byte
Wrap the placeholder in single quotes to make it valid YAML