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

Function GetJSONPath

pkg/sql/sem/tree/eval.go:527–538  ·  view source on GitHub ↗

GetJSONPath is used for the #> and #>> operators.

(j json.JSON, ary DArray)

Source from the content-addressed store, hash-verified

525
526// GetJSONPath is used for the #> and #>> operators.
527func GetJSONPath(j json.JSON, ary DArray) (json.JSON, error) {
528 // TODO(justin): this is slightly annoying because we have to allocate
529 // a new array since the JSON package isn't aware of DArray.
530 path := make([]string, len(ary.Array))
531 for i, v := range ary.Array {
532 if v == DNull {
533 return nil, nil
534 }
535 path[i] = string(MustBeDString(v))
536 }
537 return json.FetchPath(j, path)
538}
539
540func addBinOp(symbol treebin.BinaryOperatorSymbol, ops ...*BinOp) {
541 s, ok := BinOps[symbol]

Callers

nothing calls this directly

Calls 2

FetchPathFunction · 0.92
MustBeDStringFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…