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

Method BoolKey

encode_bool.go:104–119  ·  view source on GitHub ↗

BoolKey adds a bool to be encoded, must be used inside an object as it will encode a key.

(key string, value bool)

Source from the content-addressed store, hash-verified

102
103// BoolKey adds a bool to be encoded, must be used inside an object as it will encode a key.
104func (enc *Encoder) BoolKey(key string, value bool) {
105 if enc.hasKeys {
106 if !enc.keyExists(key) {
107 return
108 }
109 }
110 enc.grow(5 + len(key))
111 r := enc.getPreviousRune()
112 if r != '{' {
113 enc.writeByte(',')
114 }
115 enc.writeByte('"')
116 enc.writeStringEscape(key)
117 enc.writeBytes(objKey)
118 enc.buf = strconv.AppendBool(enc.buf, value)
119}
120
121// BoolKeyOmitEmpty adds a bool to be encoded and skips it if it is zero value.
122// Must be used inside an object as it will encode a key.

Callers 8

AddSQLNullBoolKeyMethod · 0.95
SQLNullBoolKeyMethod · 0.95
AddBoolKeyMethod · 0.95
MarshalJSONObjectMethod · 0.80
MarshalJSONObjectMethod · 0.80
MarshalJSONObjectMethod · 0.80
MarshalJSONObjectMethod · 0.80
MarshalJSONObjectMethod · 0.80

Calls 6

keyExistsMethod · 0.95
growMethod · 0.95
getPreviousRuneMethod · 0.95
writeByteMethod · 0.95
writeStringEscapeMethod · 0.95
writeBytesMethod · 0.95

Tested by 1

MarshalJSONObjectMethod · 0.64