Documentation ¶
Overview ¶
Package thrift contains functionality for converting generic data structures to and from Thrift payloads.
Index ¶
- func CheckSuccess(spec *compile.FunctionSpec, responseBytes []byte, opts Options) error
- func Parse(file string) (*compile.Module, error)
- func RequestToBytes(method *compile.FunctionSpec, request map[string]interface{}, opts Options) ([]byte, error)
- func ResponseBytesToMap(spec *compile.FunctionSpec, responseBytes []byte, opts Options) (map[string]interface{}, error)
- func SplitMethod(fullMethod string) (svc, method string, err error)
- type Options
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 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 ¶
SplitMethod takes a method name like Service::Method and splits it into Service and Method.