v0.21.1 Latest Latest

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

Go to latest
Published: Apr 2, 2022 License: MIT Imports: 17 Imported by: 0



Package thrift contains functionality for converting generic data structures to and from Thrift payloads.



This section is empty.


This section is empty.


func CheckSuccess

func CheckSuccess(spec *compile.FunctionSpec, responseBytes []byte, opts Options) error

CheckSuccess returns an error if the result is not successful. A response is successful if: - Thrift deserialization is successful (lazy fields are not evaluated) - Only Field ID 0 (if the method has a return type) or no fields are set.

func Parse

func Parse(file string) (*compile.Module, error)

Parse parses the given Thrift file.

func RequestToBytes

func RequestToBytes(method *compile.FunctionSpec, request map[string]interface{}, opts Options) ([]byte, error)

RequestToBytes takes a user request and converts it to the Thrift binary payload. It uses the method spec to convert the user request.

func ResponseBytesToMap

func ResponseBytesToMap(spec *compile.FunctionSpec, responseBytes []byte, opts Options) (map[string]interface{}, error)

ResponseBytesToMap takes the given response bytes and creates a map that uses field name as keys.

func SplitMethod

func SplitMethod(fullMethod string) (svc, method string, err error)

SplitMethod takes a method name like Service::Method and splits it into Service and Method.


type Options

type Options struct {
	UseEnvelopes         bool
	EnvelopeMethodPrefix string

Options controls the serialization of the Thrift request/response.

Jump to

Keyboard shortcuts

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