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

Function FetchPath

pkg/util/json/json.go:1061–1075  ·  view source on GitHub ↗

FetchPath implements the #> operator.

(j JSON, path []string)

Source from the content-addressed store, hash-verified

1059
1060// FetchPath implements the #> operator.
1061func FetchPath(j JSON, path []string) (JSON, error) {
1062 var next JSON
1063 var err error
1064 for _, v := range path {
1065 next, err = j.FetchValKeyOrIdx(v)
1066 if next == nil {
1067 return nil, nil
1068 }
1069 if err != nil {
1070 return nil, err
1071 }
1072 j = next
1073 }
1074 return j, nil
1075}
1076
1077var errCannotSetPathInScalar = pgerror.WithCandidateCode(errors.New("cannot set path in scalar"), pgcode.InvalidParameterValue)
1078

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…