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

Method EncodeString

encode_string.go:4–15  ·  view source on GitHub ↗

EncodeString encodes a string to

(s string)

Source from the content-addressed store, hash-verified

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

Callers 6

EncodeMethod · 0.95
ExampleNewEncoderFunction · 0.80
ExampleBorrowEncoderFunction · 0.80

Calls 3

encodeStringMethod · 0.95
WriteMethod · 0.95

Tested by 5

ExampleNewEncoderFunction · 0.64
ExampleBorrowEncoderFunction · 0.64