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

Method encode

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

Source from the content-addressed store, hash-verified

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

Callers

nothing calls this directly

Calls 3

checkLengthFunction · 0.85
makeNumberJEntryFunction · 0.85

Tested by

no test coverage detected