Documentation ¶
Overview ¶
Package gateway contains marshaling code extracted from github.com/grpc-ecosystem/grpc-gateway/runtime and altered to depend on gogo versions of the proto and jsonpb packages.
Index ¶
- type HTTPBodyMarshaler
- type JSONPb
- func (*JSONPb) ContentType() string
- func (j *JSONPb) Delimiter() []byte
- func (j *JSONPb) Marshal(v interface{}) ([]byte, error)
- func (j *JSONPb) NewDecoder(r io.Reader) runtime.Decoder
- func (j *JSONPb) NewEncoder(w io.Writer) runtime.Encoder
- func (j *JSONPb) Unmarshal(data []byte, v interface{}) error
- type Proto
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type HTTPBodyMarshaler ¶
HTTPBodyMarshaler is a Marshaler which supports marshaling of a google.api.HttpBody message as the full response body if it is the actual message used as the response. If not, then this will simply fallback to the Marshaler specified as its default Marshaler.
func (*HTTPBodyMarshaler) ContentType ¶
func (h *HTTPBodyMarshaler) ContentType() string
ContentType implementation to keep backwards compatability with marshal interface
func (*HTTPBodyMarshaler) ContentTypeFromMessage ¶
func (h *HTTPBodyMarshaler) ContentTypeFromMessage(v interface{}) string
ContentTypeFromMessage in case v is a google.api.HttpBody message it returns its specified content type otherwise fall back to the default Marshaler.
func (*HTTPBodyMarshaler) Marshal ¶
func (h *HTTPBodyMarshaler) Marshal(v interface{}) ([]byte, error)
Marshal marshals "v" by returning the body bytes if v is a google.api.HttpBody message, otherwise it falls back to the default Marshaler.
type JSONPb ¶
JSONPb is a runtime.Marshaler which marshals/unmarshals into/from JSON with "github.com/gogo/protobuf/jsonpb".
func (*JSONPb) ContentType ¶
ContentType always returns "application/json".
func (*JSONPb) NewDecoder ¶
NewDecoder returns a runtime.Decoder which reads JSON stream from "r".
func (*JSONPb) NewEncoder ¶
NewEncoder returns an Encoder which writes JSON stream into "w".
type Proto ¶
type Proto struct { // CustomContentType overrides the default Content-Type // of "application/octet-stream". CustomContentType string }
Proto is a runtime.Marshaller which marshals/unmarshals into/from serialize proto bytes
func (*Proto) ContentType ¶
ContentType returns the Content-Type. If CustomContentType is empty, it returns "application/octet-stream".
func (*Proto) NewDecoder ¶
NewDecoder returns a Decoder which reads proto stream from "reader".
func (*Proto) NewEncoder ¶
NewEncoder returns an Encoder which writes proto stream into "writer".