MCPcopy Create free account
hub / github.com/cockroachdb/cockroachdb-parser / DeepSet

Function DeepSet

pkg/util/json/json.go:2226–2231  ·  view source on GitHub ↗

DeepSet sets a path to a value in a JSON document. Largely follows the same semantics as setValKeyOrIdx, but with a path. Implements the jsonb_set builtin.

(j JSON, path []string, to JSON, createMissing bool)

Source from the content-addressed store, hash-verified

2224// Largely follows the same semantics as setValKeyOrIdx, but with a path.
2225// Implements the jsonb_set builtin.
2226func DeepSet(j JSON, path []string, to JSON, createMissing bool) (JSON, error) {
2227 if j.isScalar() {
2228 return nil, errCannotSetPathInScalar
2229 }
2230 return deepSet(j, path, to, createMissing)
2231}
2232
2233func deepSet(j JSON, path []string, to JSON, createMissing bool) (JSON, error) {
2234 switch len(path) {

Callers

nothing calls this directly

Calls 2

deepSetFunction · 0.85
isScalarMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…