protobuf

package
v0.0.0-...-98072da Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2019 License: MIT Imports: 10 Imported by: 0

README

GoDoc

protobuf

Package protobuf provides fasthttp codec for protobuf.

Documentation

Overview

Package protobuf provides fasthttp codec for protobuf.

Index

Constants

This section is empty.

Variables

View Source
var (
	// IngoreContentType Content-Type header will be ignored when decoding the body
	IngoreContentType bool

	// ProtobufContentType Content-Type header value that indicates that the content is protocol buffer
	ProtobufContentType = "application/x-protobuf"

	// DefaultBufferSize Buffer default size
	DefaultBufferSize = 64
)

Functions

func DecodeProtobufRequest

func DecodeProtobufRequest(_ context.Context, r *fasthttp.Request, request interface{}) error

DecodeProtobufRequest is an fasthttp_transport.DecodeRequestFunc that deserializes the response as a protobuf message object from the Request body. Many protobuf-over-HTTP services can use it as a sensible default.

func DecodeProtobufResponse

func DecodeProtobufResponse(_ context.Context, resp *fasthttp.Response, response interface{}) error

DecodeProtobufResponse is an fasthttp_transport.DecodeResponseFunc that deserializes the response as a response object from the Response body. Many protobuf-over-HTTP services can use it as a sensible default.

func EncodeProtobufRequest

func EncodeProtobufRequest(_ context.Context, r *fasthttp.Request, request interface{}) error

EncodeProtobufRequest is an fasthttp_transport.EncodeRequestFunc that serializes the request as a protobuf message object to the Request body. Many protobuf-over-HTTP services can use it as a sensible default. If the request implements Headerer, the provided headers will be applied to the request.

func EncodeProtobufResponse

func EncodeProtobufResponse(_ context.Context, resp *fasthttp.Response, response interface{}) error

EncodeProtobufResponse is a fasthttp_transport.EncodeResponseFunc that serializes the response as a protobuf message object to the Response. Many protobuf-over-HTTP services can use it as a sensible default. If the response implements Headerer, the provided headers will be applied to the response. If the response implements StatusCoder, the provided StatusCode will be used instead of 200.

Types

This section is empty.

Jump to

Keyboard shortcuts

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