2020-11-06 01:11:38 +00:00
|
|
|
package yqlib
|
|
|
|
|
|
|
|
import (
|
|
|
|
"container/list"
|
|
|
|
"fmt"
|
|
|
|
)
|
|
|
|
|
2024-01-11 02:17:34 +00:00
|
|
|
func getDocumentIndexOperator(_ *dataTreeNavigator, context Context, _ *ExpressionNode) (Context, error) {
|
2020-11-06 01:11:38 +00:00
|
|
|
var results = list.New()
|
|
|
|
|
2021-02-02 07:17:59 +00:00
|
|
|
for el := context.MatchingNodes.Front(); el != nil; el = el.Next() {
|
2020-11-06 01:11:38 +00:00
|
|
|
candidate := el.Value.(*CandidateNode)
|
2023-10-18 01:11:53 +00:00
|
|
|
scalar := candidate.CreateReplacement(ScalarNode, "!!int", fmt.Sprintf("%v", candidate.GetDocument()))
|
2020-11-06 01:11:38 +00:00
|
|
|
results.PushBack(scalar)
|
|
|
|
}
|
2021-02-02 07:17:59 +00:00
|
|
|
return context.ChildContext(results), nil
|
2020-11-06 01:11:38 +00:00
|
|
|
}
|