encodeBool encodes a bool to JSON
(v bool)
| 18 | |
| 19 | // encodeBool encodes a bool to JSON |
| 20 | func (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) |
| 31 | func (enc *Encoder) AddBool(v bool) { |
no test coverage detected