MCPcopy
hub / github.com/tidwall/sjson / SetRawBytesOptions

Function SetRawBytesOptions

sjson.go:723–737  ·  view source on GitHub ↗

SetRawBytesOptions sets a raw json value for the specified path with options. If working with bytes, this method preferred over SetRawOptions(string(data), path, value, opts)

(json []byte, path string, value []byte,
	opts *Options)

Source from the content-addressed store, hash-verified

721// If working with bytes, this method preferred over
722// SetRawOptions(string(data), path, value, opts)
723func SetRawBytesOptions(json []byte, path string, value []byte,
724 opts *Options) ([]byte, error) {
725 jstr := *(*string)(unsafe.Pointer(&json))
726 vstr := *(*string)(unsafe.Pointer(&value))
727 var optimistic, inplace bool
728 if opts != nil {
729 optimistic = opts.Optimistic
730 inplace = opts.ReplaceInPlace
731 }
732 res, err := set(jstr, path, vstr, false, false, optimistic, inplace)
733 if err == errNoChange {
734 return json, nil
735 }
736 return res, err
737}

Callers 1

SetRawBytesFunction · 0.85

Calls 1

setFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…