Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ( // ErrHealthThriftOnly is returned if the user specifies an unsupported encoding with --health. ErrHealthThriftOnly = errors.New("--health can only be used with Thrift") )
View Source
var ( // ErrSpecifyThriftFile is returned if no Thrift file is specified // for a Thrift request. ErrSpecifyThriftFile = errors.New("specify a Thrift file using --thrift") )
Functions ¶
This section is empty.
Types ¶
type Encoding ¶
type Encoding string
Encoding is the representation of the data on the wire.
const ( UnspecifiedEncoding Encoding = "" JSON Encoding = "json" Thrift Encoding = "thrift" Raw Encoding = "raw" Protobuf Encoding = "proto" )
The list of supported encodings.
func (Encoding) GetHealth ¶
func (e Encoding) GetHealth() (Serializer, error)
GetHealth returns a serializer for the Health endpoint.
func (*Encoding) UnmarshalFlag ¶
UnmarshalFlag allows Encoding to be used as a flag.
func (*Encoding) UnmarshalText ¶
UnmarshalText imlements the encoding.TextUnmarshaler interface used by JSON, YAML, etc.
type Serializer ¶
type Serializer interface { // Encoding returns the encoding for this serializer. Encoding() Encoding // Request creates a transport.Request from the given []byte input. Request(body []byte) (*transport.Request, error) // Response converts a transport.Response into something that can be displayed to a user. // For non-raw encodings, this is typically a map[string]interface{}. Response(body *transport.Response) (response interface{}, err error) // CheckSuccess checks whether the response body is a success, and if not, returns an // error with the failure reason. CheckSuccess(body *transport.Response) error }
Serializer serializes and deserializes data for a specific encoding and method.
func NewProtobuf ¶ added in v0.14.0
func NewProtobuf(fullMethodName string, source protobuf.DescriptorProvider) (Serializer, error)
NewProtobuf returns a protobuf serializer.
Click to show internal directories.
Click to hide internal directories.