MCPcopy Create free account
hub / github.com/dolthub/doltgresql / decode

Method decode

postgres/parser/json/encoded.go:533–554  ·  view source on GitHub ↗

decode should be used in cases where you will definitely have to use the entire decoded JSON structure, like printing it out to a string.

()

Source from the content-addressed store, hash-verified

531// decode should be used in cases where you will definitely have to use the
532// entire decoded JSON structure, like printing it out to a string.
533func (j *jsonEncoded) decode() (JSON, error) {
534 switch j.typ {
535 case NumberJSONType:
536 _, j, err := decodeJSONNumber(j.value)
537 return j, err
538 case StringJSONType:
539 return jsonString(j.value), nil
540 case TrueJSONType:
541 return TrueJSONValue, nil
542 case FalseJSONType:
543 return FalseJSONValue, nil
544 case NullJSONType:
545 return NullJSONValue, nil
546 }
547 _, decoded, err := DecodeJSON(j.value)
548
549 j.mu.Lock()
550 defer j.mu.Unlock()
551 j.mu.cachedDecoded = decoded
552
553 return decoded, err
554}
555
556func (j *jsonEncoded) AsText() (*string, error) {
557 if dec := j.alreadyDecoded(); dec != nil {

Callers 10

shallowDecodeMethod · 0.95
AsTextMethod · 0.95
ExistsMethod · 0.95
FormatMethod · 0.95
allPathsMethod · 0.95
HasContainerLeafMethod · 0.95
preprocessForContainsMethod · 0.95
decodeIfNeededFunction · 0.80

Calls 5

decodeJSONNumberFunction · 0.85
jsonStringTypeAlias · 0.85
DecodeJSONFunction · 0.85
LockMethod · 0.80
UnlockMethod · 0.80

Tested by

no test coverage detected