runtime

package
v1.2.115 Latest Latest
Warning

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

Go to latest
Published: Feb 26, 2024 License: MIT Imports: 9 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

ApplyOptions call apply() for all options one by one

type HTTPBodyPbOption

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

A HTTPBodyPbOption sets options.

func WithHTTPBodyPb added in v1.2.100

func WithHTTPBodyPb(v HTTPBodyPb) HTTPBodyPbOption

WithHTTPBodyPb sets HTTPBodyPb.

func WithMarshaler

func WithMarshaler(marshaler runtime.Marshaler) HTTPBodyPbOption

WithMarshaler 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
}

JSONPb json -> proto|interface{}

func (*JSONPb) ApplyOptions

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

ApplyOptions call apply() for all options one by one

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

WithEmitAsInts specifies whether to render enum values as integers, as opposed to string values.

func WithEmitDefaults

func WithEmitDefaults(emitDefaults bool) JSONPbOption

WithEmitDefaults specifies whether to render fields with zero values.

func WithIndent

func WithIndent(indent string) JSONPbOption

WithIndent controls whether the output is compact or not.

func WithJSONPb added in v1.2.100

func WithJSONPb(v JSONPb) JSONPbOption

WithJSONPb sets JSONPb.

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
}

ProtoMarshaller is a Marshaller which marshals/unmarshals into/from serialize proto bytes, but ContentType() always returns "application/x-protobuf". []byte -> proto|interface{}

func (*ProtoMarshaller) ContentType

func (*ProtoMarshaller) ContentType() string

ContentType always returns "application/x-protobuf".

type YamlDecoderWrapper

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

YamlDecoderWrapper 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
}

YamlMarshaller []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