MCPcopy Create free account
hub / github.com/francoispqt/gojay / EncodeInt

Method EncodeInt

encode_number_int.go:6–16  ·  view source on GitHub ↗

EncodeInt encodes an int to JSON

(n int)

Source from the content-addressed store, hash-verified

4
5// EncodeInt encodes an int to JSON
6func (enc *Encoder) EncodeInt(n int) error {
7 if enc.isPooled == 1 {
8 panic(InvalidUsagePooledEncoderError("Invalid usage of pooled encoder"))
9 }
10 _, _ = enc.encodeInt(n)
11 _, err := enc.Write()
12 if err != nil {
13 return err
14 }
15 return nil
16}
17
18// encodeInt encodes an int to JSON
19func (enc *Encoder) encodeInt(n int) ([]byte, error) {

Callers 3

EncodeMethod · 0.95

Calls 3

encodeIntMethod · 0.95
WriteMethod · 0.95

Tested by 2