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

Method encodeBool

encode_bool.go:20–28  ·  view source on GitHub ↗

encodeBool encodes a bool to JSON

(v bool)

Source from the content-addressed store, hash-verified

18
19// encodeBool encodes a bool to JSON
20func (enc *Encoder) encodeBool(v bool) ([]byte, error) {
21 enc.grow(5)
22 if v {
23 enc.writeString("true")
24 } else {
25 enc.writeString("false")
26 }
27 return enc.buf, enc.err
28}
29
30// AddBool adds a bool to be encoded, must be used inside a slice or array encoding (does not encode a key)
31func (enc *Encoder) AddBool(v bool) {

Callers 3

EncodeSQLNullBoolMethod · 0.95
EncodeBoolMethod · 0.95
marshalFunction · 0.80

Calls 2

growMethod · 0.95
writeStringMethod · 0.95

Tested by

no test coverage detected