2020-11-06 01:11:38 +00:00
|
|
|
package yqlib
|
|
|
|
|
|
|
|
import (
|
|
|
|
"container/list"
|
|
|
|
"fmt"
|
|
|
|
|
|
|
|
"gopkg.in/yaml.v3"
|
|
|
|
)
|
|
|
|
|
2021-01-11 06:13:48 +00:00
|
|
|
func getDocumentIndexOperator(d *dataTreeNavigator, matchingNodes *list.List, pathNode *PathTreeNode) (*list.List, error) {
|
2020-11-06 01:11:38 +00:00
|
|
|
var results = list.New()
|
|
|
|
|
|
|
|
for el := matchingNodes.Front(); el != nil; el = el.Next() {
|
|
|
|
candidate := el.Value.(*CandidateNode)
|
|
|
|
node := &yaml.Node{Kind: yaml.ScalarNode, Value: fmt.Sprintf("%v", candidate.Document), Tag: "!!int"}
|
2021-01-12 08:36:28 +00:00
|
|
|
scalar := candidate.CreateChild(nil, node)
|
2020-11-06 01:11:38 +00:00
|
|
|
results.PushBack(scalar)
|
|
|
|
}
|
|
|
|
return results, nil
|
|
|
|
}
|