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

Function checkLength

postgres/parser/json/encode.go:53–58  ·  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

51// JEntry header. This should never come up, since it would require a ~250MB
52// JSON value, but check it just to be safe.
53func checkLength(length int) error {
54 if length > maxByteLength {
55 return errors.AssertionFailedf("JSON value too large: %d bytes", errors.Safe(length))
56 }
57 return nil
58}
59
60// Note: the encoding of each of null, true, and false are the encoding of length 0.
61// 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