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

Method String

encode_string.go:68–78  ·  view source on GitHub ↗

String adds a string to be encoded, must be used inside a slice or array encoding (does not encode a key)

(v string)

Source from the content-addressed store, hash-verified

66
67// String adds a string to be encoded, must be used inside a slice or array encoding (does not encode a key)
68func (enc *Encoder) String(v string) {
69 enc.grow(len(v) + 4)
70 r := enc.getPreviousRune()
71 if r != '[' {
72 enc.writeTwoBytes(',', '"')
73 } else {
74 enc.writeByte('"')
75 }
76 enc.writeStringEscape(v)
77 enc.writeByte('"')
78}
79
80// StringOmitEmpty adds a string to be encoded or skips it if it is zero value.
81// Must be used inside a slice or array encoding (does not encode a key)

Callers 6

AddSQLNullStringMethod · 0.95
SQLNullStringMethod · 0.95
AddStringMethod · 0.95
SliceStringMethod · 0.95
SliceStringKeyMethod · 0.95

Calls 5

growMethod · 0.95
getPreviousRuneMethod · 0.95
writeTwoBytesMethod · 0.95
writeByteMethod · 0.95
writeStringEscapeMethod · 0.95

Tested by

no test coverage detected