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

Method EncodeBool

encode_bool.go:6–17  ·  view source on GitHub ↗

EncodeBool encodes a bool to JSON

(v bool)

Source from the content-addressed store, hash-verified

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

Callers 3

EncodeMethod · 0.95
TestEncoderBoolEncodeAPIFunction · 0.80
TestEncoderBoolErrorsFunction · 0.80

Calls 3

encodeBoolMethod · 0.95
WriteMethod · 0.95

Tested by 2

TestEncoderBoolEncodeAPIFunction · 0.64
TestEncoderBoolErrorsFunction · 0.64