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)
| 721 | // If working with bytes, this method preferred over |
| 722 | // SetRawOptions(string(data), path, value, opts) |
| 723 | func 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 | } |
no test coverage detected
searching dependent graphs…