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

Function checkLength

pkg/util/json/encode.go:33–38  ·  view source on GitHub ↗

checkLength ensures that an encoded value is not too long to fit into the JEntry header. This should never come up, since it would require a ~250MB JSON value, but check it just to be safe.

(length int)

Source from the content-addressed store, hash-verified

31// JEntry header. This should never come up, since it would require a ~250MB
32// JSON value, but check it just to be safe.
33func checkLength(length int) error {
34 if length > maxByteLength {
35 return errors.Newf("JSON value too large: %d bytes", errors.Safe(length))
36 }
37 return nil
38}
39
40// Note: the encoding of each of null, true, and false are the encoding of length 0.
41// Their values are purely dictated by their type.

Callers 4

encodeMethod · 0.85
encodeMethod · 0.85
encodeMethod · 0.85
encodeMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…