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

Method format

pkg/util/json/encoded_format.go:29–53  ·  view source on GitHub ↗
(buf *bytes.Buffer)

Source from the content-addressed store, hash-verified

27}
28
29func (j *jsonEncoded) format(buf *bytes.Buffer) error {
30 switch j.typ {
31 case NumberJSONType:
32 _, d, err := decodeJSONNumber(j.value)
33 if err != nil {
34 return err
35 }
36 d.Format(buf)
37 case StringJSONType:
38 s := unsafeJSONString(j.value)
39 s.Format(buf)
40 case TrueJSONType:
41 TrueJSONValue.Format(buf)
42 case FalseJSONType:
43 FalseJSONValue.Format(buf)
44 case NullJSONType:
45 NullJSONValue.Format(buf)
46 default:
47 _, err := formatEncodedJSON(buf, j.value)
48 if err != nil {
49 return err
50 }
51 }
52 return nil
53}
54
55func formatEncodedJSON(buf *bytes.Buffer, b []byte) ([]byte, error) {
56 b, containerHeader, err := encoding.DecodeUint32Ascending(b)

Callers 1

FormatMethod · 0.95

Calls 5

FormatMethod · 0.95
decodeJSONNumberFunction · 0.85
unsafeJSONStringFunction · 0.85
formatEncodedJSONFunction · 0.85
FormatMethod · 0.65

Tested by

no test coverage detected