Documentation ¶
Index ¶
- func Delete(root map[string]interface{}, path util.Path) (bool, error)
- func Find(inputTree map[string]interface{}, path util.Path) (interface{}, bool, error)
- func GetValueFromSetFlags(setFlags []string, key string) string
- func MergeNode(root interface{}, path util.Path, value interface{}) error
- func OverlaySetFlags(base string, setFlags []string) (string, error)
- func ParseValue(valueStr string) interface{}
- func ReadAndOverlayYamls(filenames []string) (string, error)
- func ReadOverlayProfileYaml(profilePath string, profile string) (string, error)
- func ReadProfileYaml(profilePath string, profile string) (string, error)
- func ReadProfilesNames(profilesPath string) ([]string, error)
- func ReadYamlAndProfile(filenames []string, setFlags []string) (string, string, error)
- func SplitSetFlag(flag string) (string, string)
- func StripPrefix(path, prefix string) string
- func WriteNode(root interface{}, path util.Path, value interface{}) error
- func WritePathContext(nc *PathContext, value interface{}, merge bool) error
- type PathContext
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Find ¶
Find returns the value at path from the given tree, or false if the path does not exist. It behaves differently from GetPathContext in that it never creates map entries at the leaf and does not provide a way to mutate the parent of the found node.
func GetValueFromSetFlags ¶
func MergeNode ¶
MergeNode merges value to the tree in root at the given path, creating any required missing internal nodes in path.
func ParseValue ¶
func ParseValue(valueStr string) interface{}
ParseValue parses string into a value
func ReadAndOverlayYamls ¶
func ReadOverlayProfileYaml ¶
func ReadProfileYaml ¶
ReadProfileYaml reads profile yaml specified by profilePath/profile.yaml and validates the content.
func ReadProfilesNames ¶
ReadProfilesNames reads all profiles in directory specified by profilesPath. It does not traverse recursively. It may add some filters in the future.
func ReadYamlAndProfile ¶
func SplitSetFlag ¶
func StripPrefix ¶
StripPrefix removes the given prefix from prefix.
func WriteNode ¶
WriteNode writes value to the tree in root at the given path, creating any required missing internal nodes in path.
func WritePathContext ¶
func WritePathContext(nc *PathContext, value interface{}, merge bool) error
WritePathContext writes the given value to the Node in the given PathContext.
Types ¶
type PathContext ¶
type PathContext struct { // Parent in the Parent of this PathContext. Parent *PathContext // KeyToChild is the key required to reach the child. KeyToChild interface{} // Node is the actual Node in the data tree. Node interface{} }
PathContext provides a means for traversing a tree towards the root.
func GetPathContext ¶
func GetPathContext(root interface{}, path util.Path, createMissing bool) (*PathContext, bool, error)
GetPathContext returns the PathContext for the Node which has the given path from root. It returns false and no error if the given path is not found, or an error code in other error situations, like a malformed path. It also creates a tree of PathContexts during the traversal so that Parent nodes can be updated if required. This is required when (say) appending to a list, where the parent list itself must be updated.
func (*PathContext) String ¶
func (nc *PathContext) String() string
String implements the Stringer interface.