thrift

package
v0.16.1 Latest Latest
Warning

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

Go to latest
Published: Oct 2, 2019 License: MIT Imports: 16 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

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.

Types

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