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

Method encode

pkg/util/json/encode.go:61–70  ·  view source on GitHub ↗
(appendTo []byte)

Source from the content-addressed store, hash-verified

59}
60
61func (j jsonNumber) encode(appendTo []byte) (e jEntry, b []byte, err error) {
62 decOffset := len(appendTo)
63 dec := apd.Decimal(j)
64 appendTo = encoding.EncodeUntaggedDecimalValue(appendTo, &dec)
65 lengthInBytes := len(appendTo) - decOffset
66 if err := checkLength(lengthInBytes); err != nil {
67 return jEntry{}, b, err
68 }
69 return makeNumberJEntry(lengthInBytes), appendTo, nil
70}
71
72// encodingModeForIdx determines which encoding mode we choose to use for a
73// given i-th entry in an array or object.

Callers

nothing calls this directly

Calls 4

checkLengthFunction · 0.85
makeNumberJEntryFunction · 0.85
DecimalMethod · 0.65

Tested by

no test coverage detected