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

Method FetchValKeyOrIdx

pkg/util/json/encoded.go:615–630  ·  view source on GitHub ↗
(key string)

Source from the content-addressed store, hash-verified

613}
614
615func (j *jsonEncoded) FetchValKeyOrIdx(key string) (JSON, error) {
616 switch j.typ {
617 case ObjectJSONType:
618 return j.FetchValKey(key)
619 case ArrayJSONType:
620 idx, err := strconv.Atoi(key)
621 if err != nil {
622 // We shouldn't return this error because it means we couldn't parse the
623 // number, meaning it was a string and that just means we can't find the
624 // value in an array.
625 return nil, nil //nolint:returnerrcheck
626 }
627 return j.FetchValIdx(idx)
628 }
629 return nil, nil
630}
631
632func (j *jsonEncoded) Format(buf *bytes.Buffer) {
633 decoded, err := j.decode()

Callers

nothing calls this directly

Calls 2

FetchValKeyMethod · 0.95
FetchValIdxMethod · 0.95

Tested by

no test coverage detected