MCPcopy
hub / github.com/connectrpc/connect-go / Codec

Interface Codec

codec.go:35–54  ·  view source on GitHub ↗

Codec marshals structs (typically generated from a schema) to and from bytes.

Source from the content-addressed store, hash-verified

33
34// Codec marshals structs (typically generated from a schema) to and from bytes.
35type Codec interface {
36 // Name returns the name of the Codec.
37 //
38 // This may be used as part of the Content-Type within HTTP. For example,
39 // with gRPC this is the content subtype, so "application/grpc+proto" will
40 // map to the Codec with name "proto".
41 //
42 // Names must not be empty.
43 Name() string
44 // Marshal marshals the given message.
45 //
46 // Marshal may expect a specific type of message, and will error if this type
47 // is not given.
48 Marshal(any) ([]byte, error)
49 // Unmarshal unmarshals the given message.
50 //
51 // Unmarshal may expect a specific type of message, and will error if this
52 // type is not given.
53 Unmarshal([]byte, any) error
54}
55
56// marshalAppender is an extension to Codec for appending to a byte slice.
57type marshalAppender interface {

Callers 24

WriteRequestHeaderMethod · 0.65
validateResponseMethod · 0.65
WriteRequestHeaderMethod · 0.65
validateResponseMethod · 0.65
validateResponseMethod · 0.65
MarshalMethod · 0.65
buildGetURLMethod · 0.65
WrapUnaryMethod · 0.65
SendMethod · 0.65
SendMethod · 0.65
grpcErrorToTrailerFunction · 0.65

Implementers 3

failCodecconnect_ext_test.go

Calls

no outgoing calls

Tested by

no test coverage detected