MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / SetPath

Function SetPath

pkg/ijson/ijson.go:229–240  ·  view source on GitHub ↗
(data any, path Path, value any, opts *SetPathOpts)

Source from the content-addressed store, hash-verified

227}
228
229func SetPath(data any, path Path, value any, opts *SetPathOpts) (any, error) {
230 if opts == nil {
231 opts = &SetPathOpts{}
232 }
233 if opts.Remove && opts.CombineFn != nil {
234 return nil, fmt.Errorf("SetPath: Remove and CombineFn are mutually exclusive")
235 }
236 if opts.Remove && value != nil {
237 return nil, fmt.Errorf("SetPath: Remove and value are mutually exclusive")
238 }
239 return setPathInternal(data, pathWithPos{Path: path, Index: 0}, value, *opts)
240}
241
242func checkAndModifyBudget(opts *SetPathOpts, pp pathWithPos, cost int) bool {
243 if opts.Budget == 0 {

Callers 3

SetPathNoErrFunction · 0.85
ApplyCommandFunction · 0.85
TestSetPathFunction · 0.85

Calls 1

setPathInternalFunction · 0.70

Tested by 1

TestSetPathFunction · 0.68