Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
var ErrSpecifyThriftFile = errors.New("specify a Thrift file using --thrift")
ErrSpecifyThriftFile is returned if no Thrift file is specified for a Thrift request.
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(serviceName string) (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 MethodType ¶ added in v0.21.1
type MethodType int
MethodType is type of the RPC method
const ( // Unary method type is a traditional RPC Unary MethodType = iota + 1 // ClientStream method type RPC sends multiple messages ClientStream // ServerStream method type RPC receives multiple messages ServerStream // BidirectionalStream type RPC can send and receive multiple messages BidirectionalStream )
type ProtoErrorDeserializer ¶ added in v0.21.1
type ProtoErrorDeserializer interface { // Error converts an error into something that can be displayed to a user. ErrorDetails(err error) ([]interface{}, error) }
ProtoErrorDeserializer deserializes errors. Error details are very specific to proto.
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 // MethodType returns the type of RPC method MethodType() MethodType }
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.
func NewThrift ¶
func NewThrift(p ThriftParams) (Serializer, error)
NewThrift returns a Thrift serializer.
type StreamRequestReader ¶ added in v0.21.1
type StreamRequestReader interface { // NextBody returns the encoded request body if available, and if not, returns an // io.EOF to indicate end of requests and caller must not call it again NextBody() ([]byte, error) }
StreamRequestReader interface exposes method to read multiple request body
type StreamSerializer ¶ added in v0.21.1
type StreamSerializer interface { // StreamRequest creates a root stream request, a stream request reader using // body reader provided StreamRequest(body io.Reader) (*transport.StreamRequest, StreamRequestReader, error) }
StreamSerializer serializes and deserializes data for a stream requests