| 1 | package executionscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ |
| 2 | |
| 3 | import ( |
| 4 | "contextscip-go gomod github.com/golang/go/src go1.25 context/" |
| 5 | "errorsscip-go gomod github.com/golang/go/src go1.25 errors/" |
| 6 | "fmtscip-go gomod github.com/golang/go/src go1.25 fmt/" |
| 7 | "github.com/tomwright/dasel/v3/modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/" |
| 8 | "github.com/tomwright/dasel/v3/selectorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector`/" |
| 9 | "github.com/tomwright/dasel/v3/selector/astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/" |
| 10 | "osscip-go gomod github.com/golang/go/src go1.25 os/" |
| 11 | "reflectscip-go gomod github.com/golang/go/src go1.25 reflect/" |
| 12 | "slicesscip-go gomod github.com/golang/go/src go1.25 slices/" |
| 13 | ) |
| 14 | |
| 15 | // ExecuteSelector parses the selector and executes the resulting AST with the given input. |
| 16 | func ExecuteSelectorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ExecuteSelector().(ctx contextscip-go gomod github.com/golang/go/src go1.25 context/.Contextscip-go gomod github.com/golang/go/src go1.25 context/Context#, selectorStr string, value *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, opts *Optionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/Options#) (*modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) { |
| 17 | if selectorStr == "" { |
| 18 | return value, nil |
| 19 | } |
| 20 | |
| 21 | expr, err := selectorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector`/.Parsescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector`/Parse().(selectorStr) |
| 22 | if err != nil { |
| 23 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("error parsing selector: %w", err) |
| 24 | } |
| 25 | |
| 26 | res, err := ExecuteASTscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ExecuteAST().(ctx, expr, value, opts) |
| 27 | if err != nil { |
| 28 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("error executing selector: %w", err) |
| 29 | } |
| 30 | |
| 31 | return res, nil |
| 32 | } |
| 33 | |
| 34 | type expressionExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/expressionExecutor# func(ctx contextscip-go gomod github.com/golang/go/src go1.25 context/.Contextscip-go gomod github.com/golang/go/src go1.25 context/Context#, options *Optionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/Options#, data *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#) (*modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) |
| 35 | |
| 36 | // ExecuteAST executes the given AST with the given input. |
| 37 | func ExecuteASTscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ExecuteAST().(ctx contextscip-go gomod github.com/golang/go/src go1.25 context/.Contextscip-go gomod github.com/golang/go/src go1.25 context/Context#, expr astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.Exprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/Expr#, value *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, options *Optionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/Options#) (*modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) { |
| 38 | if expr == nil { |
| 39 | return value, nil |
| 40 | } |
| 41 | |
| 42 | executorFn, err := exprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/exprExecutor().(options, expr) |
| 43 | if err != nil { |
| 44 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("error evaluating expression %T: %w", expr, err) |
| 45 | } |
| 46 | |
| 47 | executor := func(ctx contextscip-go gomod github.com/golang/go/src go1.25 context/.Contextscip-go gomod github.com/golang/go/src go1.25 context/Context#, options *Optionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/Options#, data *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#) (*modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) { |
| 48 | options.Varsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/Options#Vars.["this"] = data |
| 49 | out, err := executorFn(ctx, options, data) |
| 50 | if err != nil { |
| 51 | return out, err |
| 52 | } |
| 53 | return out, nil |
| 54 | } |
| 55 | |
| 56 | if !value.IsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsBranch().() { |
| 57 | res, err := executor(ctx, options, value) |
| 58 | if err != nil { |
| 59 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("execution error when processing %T: %w", expr, err) |
| 60 | } |
| 61 | return res, nil |
| 62 | } |
| 63 | |
| 64 | res := modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewSliceValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewSliceValue().() |
| 65 | res.MarkAsBranchscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#MarkAsBranch().() |
| 66 | |
| 67 | if err := value.RangeSlicescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#RangeSlice().(func(i int, v *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#) error { |
| 68 | r, err := executor(ctx, options, v) |
| 69 | if err != nil { |
| 70 | return err |
| 71 | } |
| 72 | if r.IsIgnorescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#IsIgnore().() { |
| 73 | return nil |
| 74 | } |
| 75 | return res.Appendscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#Append().(r) |
| 76 | }); err != nil { |
| 77 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("branch execution error when processing %T: %w", expr, err) |
| 78 | } |
| 79 | |
| 80 | return res, nil |
| 81 | } |
| 82 | |
| 83 | var unstableAstTypesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/unstableAstTypes. = []reflectscip-go gomod github.com/golang/go/src go1.25 reflect/.Typescip-go gomod github.com/golang/go/src go1.25 reflect/Type#{ |
| 84 | reflectscip-go gomod github.com/golang/go/src go1.25 reflect/.TypeForscip-go gomod github.com/golang/go/src go1.25 reflect/TypeFor().[astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.BranchExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/BranchExpr#](), |
| 85 | } |
| 86 | |
| 87 | func exprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/exprExecutor().(options *Optionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/Options#, expr astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.Exprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/Expr#) (expressionExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/expressionExecutor#, error) { |
| 88 | if !options.Unstablescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/Options#Unstable. && (slicesscip-go gomod github.com/golang/go/src go1.25 slices/.Containsscip-go gomod github.com/golang/go/src go1.25 slices/Contains().(unstableAstTypesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/unstableAstTypes., reflectscip-go gomod github.com/golang/go/src go1.25 reflect/.TypeOfscip-go gomod github.com/golang/go/src go1.25 reflect/TypeOf().(expr)) || |
| 89 | slicesscip-go gomod github.com/golang/go/src go1.25 slices/.Containsscip-go gomod github.com/golang/go/src go1.25 slices/Contains().(unstableAstTypesscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/unstableAstTypes., reflectscip-go gomod github.com/golang/go/src go1.25 reflect/.ValueOfscip-go gomod github.com/golang/go/src go1.25 reflect/ValueOf().(expr).Typescip-go gomod github.com/golang/go/src go1.25 reflect/Value#Type().())) { |
| 90 | return nil, errorsscip-go gomod github.com/golang/go/src go1.25 errors/.Newscip-go gomod github.com/golang/go/src go1.25 errors/New().("unstable ast types are not enabled. to enable them use --unstable") |
| 91 | } |
| 92 | |
| 93 | switch e := expr.(type) { |
| 94 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.BinaryExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/BinaryExpr#: |
| 95 | return binaryExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/binaryExprExecutor().(e) |
| 96 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.UnaryExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/UnaryExpr#: |
| 97 | return unaryExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/unaryExprExecutor().(e) |
| 98 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.CallExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/CallExpr#: |
| 99 | return callExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/callExprExecutor().(options, e) |
| 100 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.ChainedExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/ChainedExpr#: |
| 101 | return chainedExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/chainedExprExecutor().(e) |
| 102 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.SpreadExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/SpreadExpr#: |
| 103 | return spreadExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/spreadExprExecutor().() |
| 104 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.RangeExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/RangeExpr#: |
| 105 | return rangeExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/rangeExprExecutor().(e) |
| 106 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.IndexExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/IndexExpr#: |
| 107 | return indexExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/indexExprExecutor().(e) |
| 108 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.PropertyExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/PropertyExpr#: |
| 109 | return propertyExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/propertyExprExecutor().(e) |
| 110 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.VariableExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/VariableExpr#: |
| 111 | return variableExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/variableExprExecutor().(e) |
| 112 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.NumberIntExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/NumberIntExpr#: |
| 113 | return numberIntExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/numberIntExprExecutor().(e) |
| 114 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.NumberFloatExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/NumberFloatExpr#: |
| 115 | return numberFloatExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/numberFloatExprExecutor().(e) |
| 116 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.StringExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/StringExpr#: |
| 117 | return stringExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/stringExprExecutor().(e) |
| 118 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.BoolExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/BoolExpr#: |
| 119 | return boolExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/boolExprExecutor().(e) |
| 120 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.ObjectExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/ObjectExpr#: |
| 121 | return objectExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/objectExprExecutor().(e) |
| 122 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.MapExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/MapExpr#: |
| 123 | return mapExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/mapExprExecutor().(e) |
| 124 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.EachExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/EachExpr#: |
| 125 | return eachExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/eachExprExecutor().(e) |
| 126 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.FilterExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/FilterExpr#: |
| 127 | return filterExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/filterExprExecutor().(e) |
| 128 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.SearchExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/SearchExpr#: |
| 129 | return searchExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/searchExprExecutor().(e) |
| 130 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.RecursiveDescentExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/RecursiveDescentExpr#: |
| 131 | return recursiveDescentExprExecutor2scip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/recursiveDescentExprExecutor2().(e) |
| 132 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.ConditionalExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/ConditionalExpr#: |
| 133 | return conditionalExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/conditionalExprExecutor().(e) |
| 134 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.BranchExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/BranchExpr#: |
| 135 | return branchExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/branchExprExecutor().(e) |
| 136 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.ArrayExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/ArrayExpr#: |
| 137 | return arrayExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/arrayExprExecutor().(e) |
| 138 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.RegexExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/RegexExpr#: |
| 139 | // Noop |
| 140 | return func(ctx contextscip-go gomod github.com/golang/go/src go1.25 context/.Contextscip-go gomod github.com/golang/go/src go1.25 context/Context#, options *Optionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/Options#, data *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#) (*modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) { |
| 141 | //ctx = WithExecutorID(ctx, "regexExpr") |
| 142 | return data, nil |
| 143 | }, nil |
| 144 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.SortByExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/SortByExpr#: |
| 145 | return sortByExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/sortByExprExecutor().(e) |
| 146 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.GroupByExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/GroupByExpr#: |
| 147 | return groupByExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/groupByExprExecutor().(e) |
| 148 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.ReduceExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/ReduceExpr#: |
| 149 | return reduceExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/reduceExprExecutor().(e) |
| 150 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.MapValuesExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/MapValuesExpr#: |
| 151 | return mapValuesExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/mapValuesExprExecutor().(e) |
| 152 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.AnyExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/AnyExpr#: |
| 153 | return anyExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/anyExprExecutor().(e) |
| 154 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.AllExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/AllExpr#: |
| 155 | return allExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/allExprExecutor().(e) |
| 156 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.CountExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/CountExpr#: |
| 157 | return countExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/countExprExecutor().(e) |
| 158 | case astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.NullExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/NullExpr#: |
| 159 | return func(ctx contextscip-go gomod github.com/golang/go/src go1.25 context/.Contextscip-go gomod github.com/golang/go/src go1.25 context/Context#, options *Optionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/Options#, data *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#) (*modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) { |
| 160 | //ctx = WithExecutorID(ctx, "nullExpr") |
| 161 | return modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewNullValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewNullValue().(), nil |
| 162 | }, nil |
| 163 | default: |
| 164 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("unhandled expression type: %T", e) |
| 165 | } |
| 166 | } |
| 167 | |
| 168 | func chainedExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/chainedExprExecutor().(e astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.ChainedExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/ChainedExpr#) (expressionExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/expressionExecutor#, error) { |
| 169 | return func(ctx contextscip-go gomod github.com/golang/go/src go1.25 context/.Contextscip-go gomod github.com/golang/go/src go1.25 context/Context#, options *Optionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/Options#, data *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#) (*modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) { |
| 170 | ctx = WithExecutorIDscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/WithExecutorID().(ctx, "chainedExpr") |
| 171 | var curData = data |
| 172 | for _, expr := range e.Exprsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/ChainedExpr#Exprs. { |
| 173 | res, err := ExecuteASTscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ExecuteAST().(ctx, expr, curData, options) |
| 174 | if err != nil { |
| 175 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("error executing expression: %w", err) |
| 176 | } |
| 177 | curData = res |
| 178 | } |
| 179 | return curData, nil |
| 180 | }, nil |
| 181 | } |
| 182 | |
| 183 | func variableExprExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/variableExprExecutor().(e astscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/.VariableExprscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/VariableExpr#) (expressionExecutorscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/expressionExecutor#, error) { |
| 184 | return func(ctx contextscip-go gomod github.com/golang/go/src go1.25 context/.Contextscip-go gomod github.com/golang/go/src go1.25 context/Context#, options *Optionsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/Options#, data *modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#) (*modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.Valuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/Value#, error) { |
| 185 | //ctx = WithExecutorID(ctx, "variableExpr") |
| 186 | varName := e.Namescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/selector/ast`/VariableExpr#Name. |
| 187 | res, ok := options.Varsscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/Options#Vars.[varName] |
| 188 | if ok { |
| 189 | return res, nil |
| 190 | } |
| 191 | |
| 192 | envVarValue := osscip-go gomod github.com/golang/go/src go1.25 os/.Getenvscip-go gomod github.com/golang/go/src go1.25 os/Getenv().(varName) |
| 193 | if envVarValue != "" { |
| 194 | return modelscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/.NewStringValuescip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/model`/NewStringValue().(envVarValue), nil |
| 195 | } |
| 196 | |
| 197 | return nil, fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Errorfscip-go gomod github.com/golang/go/src go1.25 fmt/Errorf().("variable %s not found", varName) |
| 198 | }, nil |
| 199 | } |