| 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 | "fmtscip-go gomod github.com/golang/go/src go1.25 fmt/" |
| 6 | ) |
| 7 | |
| 8 | type ctxKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ctxKey# string |
| 9 | |
| 10 | const ( |
| 11 | executorIDCtxKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/executorIDCtxKey. ctxKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ctxKey# = "executorID" |
| 12 | executorPathCtxKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/executorPathCtxKey. ctxKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ctxKey# = "executorPath" |
| 13 | executorDepthCtxKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/executorDepthCtxKey. ctxKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ctxKey# = "executorDepth" |
| 14 | ) |
| 15 | |
| 16 | func WithExecutorIDscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/WithExecutorID().(ctx contextscip-go gomod github.com/golang/go/src go1.25 context/.Contextscip-go gomod github.com/golang/go/src go1.25 context/Context#, executorID string) contextscip-go gomod github.com/golang/go/src go1.25 context/.Contextscip-go gomod github.com/golang/go/src go1.25 context/Context# { |
| 17 | currentPath := ExecutorPathscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ExecutorPath().(ctx) |
| 18 | newPath := fmtscip-go gomod github.com/golang/go/src go1.25 fmt/.Sprintfscip-go gomod github.com/golang/go/src go1.25 fmt/Sprintf().("%s/%s", currentPath, executorID) |
| 19 | currentDepth := ExecutorDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ExecutorDepth().(ctx) |
| 20 | newDepth := currentDepth + 1 |
| 21 | ctx = contextscip-go gomod github.com/golang/go/src go1.25 context/.WithValuescip-go gomod github.com/golang/go/src go1.25 context/WithValue().(ctx, executorIDCtxKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/executorIDCtxKey., executorID) |
| 22 | ctx = contextscip-go gomod github.com/golang/go/src go1.25 context/.WithValuescip-go gomod github.com/golang/go/src go1.25 context/WithValue().(ctx, executorPathCtxKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/executorPathCtxKey., newPath) |
| 23 | ctx = contextscip-go gomod github.com/golang/go/src go1.25 context/.WithValuescip-go gomod github.com/golang/go/src go1.25 context/WithValue().(ctx, executorDepthCtxKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/executorDepthCtxKey., newDepth) |
| 24 | return ctx |
| 25 | } |
| 26 | |
| 27 | func ExecutorIDscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ExecutorID().(ctx contextscip-go gomod github.com/golang/go/src go1.25 context/.Contextscip-go gomod github.com/golang/go/src go1.25 context/Context#) string { |
| 28 | v, ok := ctx.Valuescip-go gomod github.com/golang/go/src go1.25 context/Context#Value().(executorIDCtxKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/executorIDCtxKey.).(string) |
| 29 | if !ok { |
| 30 | return "" |
| 31 | } |
| 32 | return v |
| 33 | } |
| 34 | |
| 35 | func ExecutorPathscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ExecutorPath().(ctx contextscip-go gomod github.com/golang/go/src go1.25 context/.Contextscip-go gomod github.com/golang/go/src go1.25 context/Context#) string { |
| 36 | v, ok := ctx.Valuescip-go gomod github.com/golang/go/src go1.25 context/Context#Value().(executorPathCtxKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/executorPathCtxKey.).(string) |
| 37 | if !ok { |
| 38 | return "" |
| 39 | } |
| 40 | return v |
| 41 | } |
| 42 | |
| 43 | func ExecutorDepthscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/ExecutorDepth().(ctx contextscip-go gomod github.com/golang/go/src go1.25 context/.Contextscip-go gomod github.com/golang/go/src go1.25 context/Context#) int { |
| 44 | v, ok := ctx.Valuescip-go gomod github.com/golang/go/src go1.25 context/Context#Value().(executorDepthCtxKeyscip-go gomod github.com/tomwright/dasel/v3 . `github.com/tomwright/dasel/v3/execution`/executorDepthCtxKey.).(int) |
| 45 | if !ok { |
| 46 | return 0 |
| 47 | } |
| 48 | return v |
| 49 | } |