runtime

package
v1.0.149 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 9, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewHTTPBodyJsonMarshaler

func NewHTTPBodyJsonMarshaler(options ...JSONPbOption) runtime.Marshaler

func NewHTTPBodyProtoMarshaler

func NewHTTPBodyProtoMarshaler() runtime.Marshaler

func NewHTTPBodyYamlMarshaler

func NewHTTPBodyYamlMarshaler() runtime.Marshaler

Types

type DecoderWrapper

type DecoderWrapper struct {
	// contains filtered or unexported fields
}

DecoderWrapper is a wrapper around a *json.Decoder that adds support for proto and json to the Decode method.

func (DecoderWrapper) Decode

func (d DecoderWrapper) Decode(v interface{}) error

Decode wraps the embedded decoder's Decode method to support protos using a jsonpb.Unmarshaler.

type EmptyHTTPBodyPbOption

type EmptyHTTPBodyPbOption struct{}

EmptyHTTPBodyPbOption does not alter the configuration. It can be embedded in another structure to build custom options.

This API is EXPERIMENTAL.

type EmptyJSONPbOption

type EmptyJSONPbOption struct{}

EmptyJSONPbOption does not alter the configuration. It can be embedded in another structure to build custom options.

This API is EXPERIMENTAL.

type HTTPBodyPb

type HTTPBodyPb runtime.HTTPBodyMarshaler

HTTPBodyPb 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 (*HTTPBodyPb) ApplyOptions

func (o *HTTPBodyPb) ApplyOptions(options ...HTTPBodyPbOption) *HTTPBodyPb

type HTTPBodyPbOption

type HTTPBodyPbOption interface {
	// contains filtered or unexported methods
}

A HTTPBodyPbOption sets options.

func WithMarshaler

func WithMarshaler(marshaler runtime.Marshaler) HTTPBodyPbOption

Whether to render enum values as integers, as opposed to string values.

type HTTPBodyPbOptionFunc

type HTTPBodyPbOptionFunc func(*HTTPBodyPb)

HTTPBodyPbOptionFunc wraps a function that modifies HTTPBodyPb into an implementation of the HTTPBodyPbOption interface.

type JSONPb

type JSONPb struct {
	runtime.JSONPb
}

json -> proto|interface{}

func (*JSONPb) ApplyOptions

func (o *JSONPb) ApplyOptions(options ...JSONPbOption) *JSONPb

func (*JSONPb) Marshal

func (j *JSONPb) Marshal(v interface{}) ([]byte, error)

func (*JSONPb) NewDecoder

func (j *JSONPb) NewDecoder(r io.Reader) runtime.Decoder

NewDecoder returns a Decoder which reads JSON stream from "r".

func (*JSONPb) NewEncoder

func (j *JSONPb) NewEncoder(w io.Writer) runtime.Encoder

NewEncoder returns an Encoder which writes JSON stream into "w".

func (*JSONPb) Unmarshal

func (j *JSONPb) Unmarshal(data []byte, v interface{}) error

Unmarshal unmarshals JSON "data" into "v"

type JSONPbOption

type JSONPbOption interface {
	// contains filtered or unexported methods
}

A JSONPbOption sets options.

func WithEmitAsInts

func WithEmitAsInts(enumsAsInts bool) JSONPbOption

Whether to render enum values as integers, as opposed to string values.

func WithEmitDefaults

func WithEmitDefaults(emitDefaults bool) JSONPbOption

Whether to render fields with zero values.

func WithIndent

func WithIndent(indent string) JSONPbOption

A string to indent each level by. The presence of this field will also cause a space to appear between the field separator and value, and for newlines to be appear between fields and array elements.

func WithOrigName

func WithOrigName(origName bool) JSONPbOption

Whether to use the original (.proto) name for fields.

type JSONPbOptionFunc

type JSONPbOptionFunc func(*JSONPb)

JSONPbOptionFunc wraps a function that modifies JSONPb into an implementation of the JSONPbOption interface.

type ProtoMarshaller

type ProtoMarshaller struct {
	runtime.ProtoMarshaller
}

[]byte -> proto|interface{}

func (*ProtoMarshaller) ContentType

func (*ProtoMarshaller) ContentType() string

ContentType always returns "application/x-protobuf".

type StatusHandler

type StatusHandler struct {
	Handler func(s *status.Status, errStructpb *structpb.Struct) proto.Message
}

func (*StatusHandler) HTTPError

func (h *StatusHandler) HTTPError(ctx context.Context, mux *runtime.ServeMux, marshaler runtime.Marshaler, w http.ResponseWriter, r *http.Request, err error)

type YamlDecoderWrapper

type YamlDecoderWrapper struct {
	// contains filtered or unexported fields
}

DecoderWrapper is a wrapper around a *json.Decoder that adds support for proto and json to the Decode method.

func (YamlDecoderWrapper) Decode

func (d YamlDecoderWrapper) Decode(v interface{}) error

Decode wraps the embedded decoder's Decode method to support protos using a jsonpb.Unmarshaler.

type YamlMarshaller

type YamlMarshaller struct {
	runtime.ProtoMarshaller
}

[]byte -> proto|interface{}

func (*YamlMarshaller) ContentType

func (*YamlMarshaller) ContentType() string

ContentType returns the Content-Type which this marshaler is responsible for.

func (*YamlMarshaller) Marshal

func (*YamlMarshaller) Marshal(v interface{}) ([]byte, error)

Marshal marshals "v" into byte sequence.

func (*YamlMarshaller) NewDecoder

func (*YamlMarshaller) NewDecoder(r io.Reader) runtime.Decoder

NewDecoder returns a Decoder which reads byte sequence from "r".

func (*YamlMarshaller) NewEncoder

func (*YamlMarshaller) NewEncoder(w io.Writer) runtime.Encoder

NewEncoder returns an Encoder which writes bytes sequence into "w".

func (*YamlMarshaller) Unmarshal

func (y *YamlMarshaller) Unmarshal(data []byte, v interface{}) error

Unmarshal unmarshals "data" into "v". "v" must be a pointer value.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL