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

Function DeepInsert

pkg/util/json/json.go:2314–2319  ·  view source on GitHub ↗

DeepInsert inserts a value at a path in a JSON document. Implements the jsonb_insert builtin.

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

Source from the content-addressed store, hash-verified

2312// DeepInsert inserts a value at a path in a JSON document.
2313// Implements the jsonb_insert builtin.
2314func DeepInsert(j JSON, path []string, to JSON, insertAfter bool) (JSON, error) {
2315 if j.isScalar() {
2316 return nil, errCannotSetPathInScalar
2317 }
2318 return deepInsert(j, path, to, insertAfter)
2319}
2320
2321func deepInsert(j JSON, path []string, to JSON, insertAfter bool) (JSON, error) {
2322 switch len(path) {

Callers

nothing calls this directly

Calls 2

deepInsertFunction · 0.85
isScalarMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…