Documentation
¶
Overview ¶
Package adapter is the codec boundary. It is interaction-model-agnostic: the core passes a Binding (never positional proto names) and the adapter never sees the inbound transport — DecodeRequest's product is the upstream intent. A future GraphQL adapter (single endpoint, request-defined response shape) implements the same interface without touching server/negotiate. v0.1 ships only the protobuf↔JSON adapter.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Adapter ¶
type Adapter interface {
DecodeRequest(b Binding, in []byte) (UpstreamCall, *wireerror.Error)
EncodeResponse(b Binding, upstreamJSON []byte) (out []byte, contentType string, err *wireerror.Error)
}
Adapter converts between an external codec and the internal JSON backend.
type Binding ¶
type Binding interface {
Method() string
Route() string
RequestMessage() string
ResponseMessage() string
}
Binding is what the adapter needs to express upstream intent. bundle.Contract satisfies it structurally (no import cycle).
type MessageResolver ¶
type MessageResolver interface {
Message(fullName string) (protoreflect.MessageDescriptor, error)
}
MessageResolver resolves a fully-qualified proto name to its descriptor. bundle.Bundle satisfies it structurally.
type ProtoJSON ¶
type ProtoJSON struct {
// contains filtered or unexported fields
}
ProtoJSON is the reference adapter: protobuf in, JSON to the upstream, and back. It owns no transport and no routing policy.
func NewProtoJSON ¶
func NewProtoJSON(r MessageResolver) *ProtoJSON
func (*ProtoJSON) DecodeRequest ¶
type UpstreamCall ¶
type UpstreamCall struct {
Method string
Path string
RawQuery string
Body []byte
ContentType string
}
UpstreamCall is the adapter's product: the intent of one upstream call. The adapter sets Method/Path/Body/ContentType from the binding + codec; it does not set RawQuery — the verbatim inbound query is transport the server owns.