MCPcopy
hub / github.com/nats-io/nats.go / Encode

Method Encode

encoders/builtin/gob_enc.go:35–42  ·  view source on GitHub ↗

FIXME(dlc) - This could probably be more efficient. Encode Deprecated: Encoded connections are no longer supported.

(subject string, v any)

Source from the content-addressed store, hash-verified

33//
34// Deprecated: Encoded connections are no longer supported.
35func (ge *GobEncoder) Encode(subject string, v any) ([]byte, error) {
36 b := new(bytes.Buffer)
37 enc := gob.NewEncoder(b)
38 if err := enc.Encode(v); err != nil {
39 return nil, err
40 }
41 return b.Bytes(), nil
42}
43
44// Decode
45//

Callers

nothing calls this directly

Calls 2

EncodeMethod · 0.95
BytesMethod · 0.65

Tested by

no test coverage detected