Share semantic document traversal helpers
This commit is contained in:
@@ -159,23 +159,6 @@ func collectFieldInfo(node *document.Node, path Path, decoded decodedConfigurati
|
||||
}
|
||||
}
|
||||
|
||||
func indexDocument(node *document.Node, path Path, index map[string]*document.Node) {
|
||||
if node == nil {
|
||||
return
|
||||
}
|
||||
index[path.String()] = node
|
||||
switch node.Kind {
|
||||
case document.Mapping:
|
||||
for _, entry := range node.Mapping {
|
||||
indexDocument(entry.Value, path.Key(entry.Key), index)
|
||||
}
|
||||
case document.Sequence:
|
||||
for position, child := range node.Sequence {
|
||||
indexDocument(child, path.Index(position), index)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func cloneMetadata(metadata Metadata) Metadata {
|
||||
if metadata.fields == nil && metadata.history == nil {
|
||||
return Metadata{}
|
||||
|
||||
Reference in New Issue
Block a user