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

Function FetchPath

pkg/util/json/json.go:2156–2170  ·  view source on GitHub ↗

FetchPath implements the #> operator.

(j JSON, path []string)

Source from the content-addressed store, hash-verified

2154
2155// FetchPath implements the #> operator.
2156func FetchPath(j JSON, path []string) (JSON, error) {
2157 var next JSON
2158 var err error
2159 for _, v := range path {
2160 next, err = j.FetchValKeyOrIdx(v)
2161 if next == nil {
2162 return nil, nil
2163 }
2164 if err != nil {
2165 return nil, err
2166 }
2167 j = next
2168 }
2169 return j, nil
2170}
2171
2172var errCannotSetPathInScalar = pgerror.WithCandidateCode(errors.New("cannot set path in scalar"), pgcode.InvalidParameterValue)
2173

Callers 1

GetJSONPathFunction · 0.92

Calls 1

FetchValKeyOrIdxMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…