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

Function decodeJSONValue

postgres/parser/json/encode.go:313–330  ·  view source on GitHub ↗
(e jEntry, b []byte)

Source from the content-addressed store, hash-verified

311}
312
313func decodeJSONValue(e jEntry, b []byte) ([]byte, JSON, error) {
314 switch e.typCode {
315 case trueTag:
316 return b, TrueJSONValue, nil
317 case falseTag:
318 return b, FalseJSONValue, nil
319 case nullTag:
320 return b, NullJSONValue, nil
321 case stringTag:
322 return b[e.length:], jsonString(b[:e.length]), nil
323 case numberTag:
324 return decodeJSONNumber(b)
325 case containerTag:
326 return DecodeJSON(b)
327 }
328 return b, nil, errors.AssertionFailedf(
329 "error decoding JSON value, unexpected type code: %d", errors.Safe(e.typCode))
330}

Callers 3

DecodeJSONFunction · 0.85
decodeJSONArrayFunction · 0.85
decodeJSONObjectFunction · 0.85

Calls 3

jsonStringTypeAlias · 0.85
decodeJSONNumberFunction · 0.85
DecodeJSONFunction · 0.85

Tested by

no test coverage detected