Documentation ¶
Index ¶
- Constants
- Variables
- type Argument
- type Feature
- func (v Feature) Equals(rhs Feature) bool
- func (v *Feature) FromWire(w wire.Value) error
- func (v Feature) MarshalJSON() ([]byte, error)
- func (v Feature) String() string
- func (v Feature) ToWire() (wire.Value, error)
- func (v *Feature) UnmarshalJSON(text []byte) error
- func (v *Feature) UnmarshalText(value []byte) error
- type Function
- type GenerateServiceRequest
- type GenerateServiceResponse
- type HandshakeRequest
- type HandshakeResponse
- type Module
- type ModuleID
- type Plugin
- type PluginHandler
- type Plugin_Goodbye_Args
- func (v *Plugin_Goodbye_Args) EnvelopeType() wire.EnvelopeType
- func (v *Plugin_Goodbye_Args) Equals(rhs *Plugin_Goodbye_Args) bool
- func (v *Plugin_Goodbye_Args) FromWire(w wire.Value) error
- func (v *Plugin_Goodbye_Args) MethodName() string
- func (v *Plugin_Goodbye_Args) String() string
- func (v *Plugin_Goodbye_Args) ToWire() (wire.Value, error)
- type Plugin_Goodbye_Result
- func (v *Plugin_Goodbye_Result) EnvelopeType() wire.EnvelopeType
- func (v *Plugin_Goodbye_Result) Equals(rhs *Plugin_Goodbye_Result) bool
- func (v *Plugin_Goodbye_Result) FromWire(w wire.Value) error
- func (v *Plugin_Goodbye_Result) MethodName() string
- func (v *Plugin_Goodbye_Result) String() string
- func (v *Plugin_Goodbye_Result) ToWire() (wire.Value, error)
- type Plugin_Handshake_Args
- func (v *Plugin_Handshake_Args) EnvelopeType() wire.EnvelopeType
- func (v *Plugin_Handshake_Args) Equals(rhs *Plugin_Handshake_Args) bool
- func (v *Plugin_Handshake_Args) FromWire(w wire.Value) error
- func (v *Plugin_Handshake_Args) MethodName() string
- func (v *Plugin_Handshake_Args) String() string
- func (v *Plugin_Handshake_Args) ToWire() (wire.Value, error)
- type Plugin_Handshake_Result
- func (v *Plugin_Handshake_Result) EnvelopeType() wire.EnvelopeType
- func (v *Plugin_Handshake_Result) Equals(rhs *Plugin_Handshake_Result) bool
- func (v *Plugin_Handshake_Result) FromWire(w wire.Value) error
- func (v *Plugin_Handshake_Result) MethodName() string
- func (v *Plugin_Handshake_Result) String() string
- func (v *Plugin_Handshake_Result) ToWire() (wire.Value, error)
- type Service
- type ServiceGenerator
- type ServiceGeneratorHandler
- type ServiceGenerator_Generate_Args
- func (v *ServiceGenerator_Generate_Args) EnvelopeType() wire.EnvelopeType
- func (v *ServiceGenerator_Generate_Args) Equals(rhs *ServiceGenerator_Generate_Args) bool
- func (v *ServiceGenerator_Generate_Args) FromWire(w wire.Value) error
- func (v *ServiceGenerator_Generate_Args) MethodName() string
- func (v *ServiceGenerator_Generate_Args) String() string
- func (v *ServiceGenerator_Generate_Args) ToWire() (wire.Value, error)
- type ServiceGenerator_Generate_Result
- func (v *ServiceGenerator_Generate_Result) EnvelopeType() wire.EnvelopeType
- func (v *ServiceGenerator_Generate_Result) Equals(rhs *ServiceGenerator_Generate_Result) bool
- func (v *ServiceGenerator_Generate_Result) FromWire(w wire.Value) error
- func (v *ServiceGenerator_Generate_Result) MethodName() string
- func (v *ServiceGenerator_Generate_Result) String() string
- func (v *ServiceGenerator_Generate_Result) ToWire() (wire.Value, error)
- type ServiceID
- type SimpleType
- func (v SimpleType) Equals(rhs SimpleType) bool
- func (v *SimpleType) FromWire(w wire.Value) error
- func (v SimpleType) MarshalJSON() ([]byte, error)
- func (v SimpleType) String() string
- func (v SimpleType) ToWire() (wire.Value, error)
- func (v *SimpleType) UnmarshalJSON(text []byte) error
- func (v *SimpleType) UnmarshalText(value []byte) error
- type Type
- type TypePair
- type TypeReference
Constants ¶
const APIVersion int32 = 3
API_VERSION is the version of the plugin API.
This MUST be provided in the HandshakeResponse.
Variables ¶
var Plugin_Goodbye_Helper = struct { // Args accepts the parameters of goodbye in-order and returns // the arguments struct for the function. Args func() *Plugin_Goodbye_Args // IsException returns true if the given error can be thrown // by goodbye. // // An error can be thrown by goodbye only if the // corresponding exception type was mentioned in the 'throws' // section for it in the Thrift file. IsException func(error) bool // WrapResponse returns the result struct for goodbye // given the error returned by it. The provided error may // be nil if goodbye did not fail. // // This allows mapping errors returned by goodbye into a // serializable result struct. WrapResponse returns a // non-nil error if the provided error cannot be thrown by // goodbye // // err := goodbye(args) // result, err := Plugin_Goodbye_Helper.WrapResponse(err) // if err != nil { // return fmt.Errorf("unexpected error from goodbye: %v", err) // } // serialize(result) WrapResponse func(error) (*Plugin_Goodbye_Result, error) // UnwrapResponse takes the result struct for goodbye // and returns the erorr returned by it (if any). // // The error is non-nil only if goodbye threw an // exception. // // result := deserialize(bytes) // err := Plugin_Goodbye_Helper.UnwrapResponse(result) UnwrapResponse func(*Plugin_Goodbye_Result) error }{}
Plugin_Goodbye_Helper provides functions that aid in handling the parameters and return values of the Plugin.goodbye function.
var Plugin_Handshake_Helper = struct { // Args accepts the parameters of handshake in-order and returns // the arguments struct for the function. Args func( request *HandshakeRequest, ) *Plugin_Handshake_Args // IsException returns true if the given error can be thrown // by handshake. // // An error can be thrown by handshake only if the // corresponding exception type was mentioned in the 'throws' // section for it in the Thrift file. IsException func(error) bool // WrapResponse returns the result struct for handshake // given its return value and error. // // This allows mapping values and errors returned by // handshake into a serializable result struct. // WrapResponse returns a non-nil error if the provided // error cannot be thrown by handshake // // value, err := handshake(args) // result, err := Plugin_Handshake_Helper.WrapResponse(value, err) // if err != nil { // return fmt.Errorf("unexpected error from handshake: %v", err) // } // serialize(result) WrapResponse func(*HandshakeResponse, error) (*Plugin_Handshake_Result, error) // UnwrapResponse takes the result struct for handshake // and returns the value or error returned by it. // // The error is non-nil only if handshake threw an // exception. // // result := deserialize(bytes) // value, err := Plugin_Handshake_Helper.UnwrapResponse(result) UnwrapResponse func(*Plugin_Handshake_Result) (*HandshakeResponse, error) }{}
Plugin_Handshake_Helper provides functions that aid in handling the parameters and return values of the Plugin.handshake function.
var ServiceGenerator_Generate_Helper = struct { // Args accepts the parameters of generate in-order and returns // the arguments struct for the function. Args func( request *GenerateServiceRequest, ) *ServiceGenerator_Generate_Args // IsException returns true if the given error can be thrown // by generate. // // An error can be thrown by generate only if the // corresponding exception type was mentioned in the 'throws' // section for it in the Thrift file. IsException func(error) bool // WrapResponse returns the result struct for generate // given its return value and error. // // This allows mapping values and errors returned by // generate into a serializable result struct. // WrapResponse returns a non-nil error if the provided // error cannot be thrown by generate // // value, err := generate(args) // result, err := ServiceGenerator_Generate_Helper.WrapResponse(value, err) // if err != nil { // return fmt.Errorf("unexpected error from generate: %v", err) // } // serialize(result) WrapResponse func(*GenerateServiceResponse, error) (*ServiceGenerator_Generate_Result, error) // UnwrapResponse takes the result struct for generate // and returns the value or error returned by it. // // The error is non-nil only if generate threw an // exception. // // result := deserialize(bytes) // value, err := ServiceGenerator_Generate_Helper.UnwrapResponse(result) UnwrapResponse func(*ServiceGenerator_Generate_Result) (*GenerateServiceResponse, error) }{}
ServiceGenerator_Generate_Helper provides functions that aid in handling the parameters and return values of the ServiceGenerator.generate function.
var ThriftModule = &thriftreflect.ThriftModule{
Name: "api",
Package: "go.uber.org/thriftrw/plugin/api",
FilePath: "api.thrift",
SHA1: "23af45cf6c28e5f48bc34318297a6f2aba817dd9",
Raw: rawIDL,
}
ThriftModule represents the IDL file used to generate this package.
Functions ¶
This section is empty.
Types ¶
type Argument ¶
type Argument struct { // Name of the argument. This is also the name of the argument field // inside the args/result struct for that function. Name string `json:"name,required"` // Argument type. Type *Type `json:"type,required"` }
Argument is a single Argument inside a Function. For,
void setValue(1: string key, 2: string value)
You get the arguments,
Argument{Name: "Key", Type: Type{SimpleType: SimpleTypeString}} Argument{Name: "Value", Type: Type{SimpleType: SimpleTypeString}}
func (*Argument) Equals ¶ added in v1.2.0
Equals returns true if all the fields of this Argument match the provided Argument.
This function performs a deep comparison.
func (*Argument) FromWire ¶
FromWire deserializes a Argument struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a Argument struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v Argument if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*Argument) ToWire ¶
ToWire translates a Argument struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type Feature ¶
type Feature int32
Feature is a functionality offered by a ThriftRW plugin.
const ( // SERVICE_GENERATOR specifies that the plugin may generate arbitrary code // for services defined in the Thrift file. // // If a plugin provides this, it MUST implement the ServiceGenerator // service. FeatureServiceGenerator Feature = 1 )
func Feature_Values ¶ added in v1.3.0
func Feature_Values() []Feature
Feature_Values returns all recognized values of Feature.
func (Feature) Equals ¶ added in v1.2.0
Equals returns true if this Feature value matches the provided value.
func (*Feature) FromWire ¶
FromWire deserializes Feature from its Thrift-level representation.
x, err := binaryProtocol.Decode(reader, wire.TI32) if err != nil { return Feature(0), err } var v Feature if err := v.FromWire(x); err != nil { return Feature(0), err } return v, nil
func (Feature) MarshalJSON ¶ added in v0.5.0
MarshalJSON serializes Feature into JSON.
If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.
This implements json.Marshaler.
func (Feature) ToWire ¶
ToWire translates Feature into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
Enums are represented as 32-bit integers over the wire.
func (*Feature) UnmarshalJSON ¶ added in v0.5.0
UnmarshalJSON attempts to decode Feature from its JSON representation.
This implementation supports both, numeric and string inputs. If a string is provided, it must be a known enum name.
This implements json.Unmarshaler.
func (*Feature) UnmarshalText ¶ added in v1.3.0
UnmarshalText tries to decode Feature from a byte slice containing its name.
var v Feature err := v.UnmarshalText([]byte("SERVICE_GENERATOR"))
type Function ¶
type Function struct { // Name of the Go function. Name string `json:"name,required"` // Name of the function as defined in the Thrift file. ThriftName string `json:"thriftName,required"` // List of arguments accepted by the function. // // This list is in the order specified by the user in the Thrift file. Arguments []*Argument `json:"arguments,required"` // Return type of the function, if any. If this is not set, the function // is a void function. ReturnType *Type `json:"returnType,omitempty"` // List of exceptions raised by the function. // // This list is in the order specified by the user in the Thrift file. Exceptions []*Argument `json:"exceptions,omitempty"` // Whether this function is oneway or not. This should be assumed to be // false unless explicitly stated otherwise. If this is true, the // returnType and exceptions will be null or empty. OneWay *bool `json:"oneWay,omitempty"` }
Function is a single function on a Thrift service.
func (*Function) Equals ¶ added in v1.2.0
Equals returns true if all the fields of this Function match the provided Function.
This function performs a deep comparison.
func (*Function) FromWire ¶
FromWire deserializes a Function struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a Function struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v Function if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*Function) GetOneWay ¶ added in v1.7.0
GetOneWay returns the value of OneWay if it is set or its zero value if it is unset.
func (*Function) ToWire ¶
ToWire translates a Function struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type GenerateServiceRequest ¶
type GenerateServiceRequest struct { // IDs of services for which code should be generated. // // Note that the services map contains information about both, the // services being generated and their transitive dependencies. Code should // only be generated for service IDs listed here. RootServices []ServiceID `json:"rootServices,required"` // Map of service ID to service. // // Any service IDs present in this request will have a corresponding // service definition in this map, including services for which code does // not need to be generated. Services map[ServiceID]*Service `json:"services,required"` // Map of module ID to module. // // Any module IDs present in the request will have a corresponding module // definition in this map. Modules map[ModuleID]*Module `json:"modules,required"` }
GenerateServiceRequest is a request to generate code for zero or more Thrift services.
func (*GenerateServiceRequest) Equals ¶ added in v1.2.0
func (v *GenerateServiceRequest) Equals(rhs *GenerateServiceRequest) bool
Equals returns true if all the fields of this GenerateServiceRequest match the provided GenerateServiceRequest.
This function performs a deep comparison.
func (*GenerateServiceRequest) FromWire ¶
func (v *GenerateServiceRequest) FromWire(w wire.Value) error
FromWire deserializes a GenerateServiceRequest struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a GenerateServiceRequest struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v GenerateServiceRequest if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*GenerateServiceRequest) String ¶
func (v *GenerateServiceRequest) String() string
String returns a readable string representation of a GenerateServiceRequest struct.
func (*GenerateServiceRequest) ToWire ¶
func (v *GenerateServiceRequest) ToWire() (wire.Value, error)
ToWire translates a GenerateServiceRequest struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type GenerateServiceResponse ¶
type GenerateServiceResponse struct { // Map of file path to file contents. // // All paths MUST be relative to the output directory into which ThriftRW // is generating code. Plugins SHOULD NOT make any assumptions about the // absolute location of the directory. // // The paths MUST NOT contain the string ".." or the request will fail. Files map[string][]byte `json:"files,omitempty"` }
GenerateServiceResponse is response to a GenerateServiceRequest.
func (*GenerateServiceResponse) Equals ¶ added in v1.2.0
func (v *GenerateServiceResponse) Equals(rhs *GenerateServiceResponse) bool
Equals returns true if all the fields of this GenerateServiceResponse match the provided GenerateServiceResponse.
This function performs a deep comparison.
func (*GenerateServiceResponse) FromWire ¶
func (v *GenerateServiceResponse) FromWire(w wire.Value) error
FromWire deserializes a GenerateServiceResponse struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a GenerateServiceResponse struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v GenerateServiceResponse if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*GenerateServiceResponse) String ¶
func (v *GenerateServiceResponse) String() string
String returns a readable string representation of a GenerateServiceResponse struct.
func (*GenerateServiceResponse) ToWire ¶
func (v *GenerateServiceResponse) ToWire() (wire.Value, error)
ToWire translates a GenerateServiceResponse struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type HandshakeRequest ¶
type HandshakeRequest struct { }
HandshakeRequest is the initial request sent to the plugin as part of establishing communication and feature negotiation.
func (*HandshakeRequest) Equals ¶ added in v1.2.0
func (v *HandshakeRequest) Equals(rhs *HandshakeRequest) bool
Equals returns true if all the fields of this HandshakeRequest match the provided HandshakeRequest.
This function performs a deep comparison.
func (*HandshakeRequest) FromWire ¶
func (v *HandshakeRequest) FromWire(w wire.Value) error
FromWire deserializes a HandshakeRequest struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a HandshakeRequest struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v HandshakeRequest if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*HandshakeRequest) String ¶
func (v *HandshakeRequest) String() string
String returns a readable string representation of a HandshakeRequest struct.
func (*HandshakeRequest) ToWire ¶
func (v *HandshakeRequest) ToWire() (wire.Value, error)
ToWire translates a HandshakeRequest struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type HandshakeResponse ¶
type HandshakeResponse struct { // Name of the plugin. This MUST match the name of the plugin specified // over the command line or the program will fail. Name string `json:"name,required"` // Version of the plugin API. // // This MUST be set to API_VERSION by the plugin. APIVersion int32 `json:"apiVersion,required"` // List of features the plugin provides. Features []Feature `json:"features,required"` // Version of ThriftRW with which the plugin was built. // // This MUST be set to go.uber.org/thriftrw/version.Version by the plugin // explicitly. LibraryVersion *string `json:"libraryVersion,omitempty"` }
HandshakeResponse is the response from the plugin for a HandshakeRequest.
func (*HandshakeResponse) Equals ¶ added in v1.2.0
func (v *HandshakeResponse) Equals(rhs *HandshakeResponse) bool
Equals returns true if all the fields of this HandshakeResponse match the provided HandshakeResponse.
This function performs a deep comparison.
func (*HandshakeResponse) FromWire ¶
func (v *HandshakeResponse) FromWire(w wire.Value) error
FromWire deserializes a HandshakeResponse struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a HandshakeResponse struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v HandshakeResponse if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*HandshakeResponse) GetLibraryVersion ¶ added in v1.7.0
func (v *HandshakeResponse) GetLibraryVersion() (o string)
GetLibraryVersion returns the value of LibraryVersion if it is set or its zero value if it is unset.
func (*HandshakeResponse) String ¶
func (v *HandshakeResponse) String() string
String returns a readable string representation of a HandshakeResponse struct.
func (*HandshakeResponse) ToWire ¶
func (v *HandshakeResponse) ToWire() (wire.Value, error)
ToWire translates a HandshakeResponse struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type Module ¶
type Module struct { // Import path for the package defining the types for this module. ImportPath string `json:"importPath,required"` // Path to the directory containing the code for this module. // // The path is relative to the output directory into which ThriftRW is // generating code. Plugins SHOULD NOT make any assumptions about the // absolute location of the directory. Directory string `json:"directory,required"` }
Module is a module generated from a single Thrift file. Each module corresponds to exactly one Thrift file and contains all the types and constants defined in that Thrift file.
func (*Module) Equals ¶ added in v1.2.0
Equals returns true if all the fields of this Module match the provided Module.
This function performs a deep comparison.
func (*Module) FromWire ¶
FromWire deserializes a Module struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a Module struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v Module if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*Module) ToWire ¶
ToWire translates a Module struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type ModuleID ¶
type ModuleID int32
ModuleID is an arbitrary unique identifier to reference the different modules in this request.
func (ModuleID) Equals ¶ added in v1.2.0
Equals returns true if this ModuleID is equal to the provided ModuleID.
func (*ModuleID) FromWire ¶
FromWire deserializes ModuleID from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
type Plugin ¶
type Plugin interface { Goodbye() error Handshake( Request *HandshakeRequest, ) (*HandshakeResponse, error) }
func NewPluginClient ¶ added in v0.5.0
NewPluginClient builds a new Plugin client.
type PluginHandler ¶ added in v0.5.0
type PluginHandler struct {
// contains filtered or unexported fields
}
PluginHandler serves an implementation of the Plugin service.
func NewPluginHandler ¶ added in v0.5.0
func NewPluginHandler(service Plugin) PluginHandler
NewPluginHandler builds a new Plugin handler.
type Plugin_Goodbye_Args ¶ added in v0.5.0
type Plugin_Goodbye_Args struct { }
Plugin_Goodbye_Args represents the arguments for the Plugin.goodbye function.
The arguments for goodbye are sent and received over the wire as this struct.
func (*Plugin_Goodbye_Args) EnvelopeType ¶ added in v0.5.0
func (v *Plugin_Goodbye_Args) EnvelopeType() wire.EnvelopeType
EnvelopeType returns the kind of value inside this struct.
This will always be Call for this struct.
func (*Plugin_Goodbye_Args) Equals ¶ added in v1.2.0
func (v *Plugin_Goodbye_Args) Equals(rhs *Plugin_Goodbye_Args) bool
Equals returns true if all the fields of this Plugin_Goodbye_Args match the provided Plugin_Goodbye_Args.
This function performs a deep comparison.
func (*Plugin_Goodbye_Args) FromWire ¶ added in v0.5.0
func (v *Plugin_Goodbye_Args) FromWire(w wire.Value) error
FromWire deserializes a Plugin_Goodbye_Args struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a Plugin_Goodbye_Args struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v Plugin_Goodbye_Args if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*Plugin_Goodbye_Args) MethodName ¶ added in v0.5.0
func (v *Plugin_Goodbye_Args) MethodName() string
MethodName returns the name of the Thrift function as specified in the IDL, for which this struct represent the arguments.
This will always be "goodbye" for this struct.
func (*Plugin_Goodbye_Args) String ¶ added in v0.5.0
func (v *Plugin_Goodbye_Args) String() string
String returns a readable string representation of a Plugin_Goodbye_Args struct.
func (*Plugin_Goodbye_Args) ToWire ¶ added in v0.5.0
func (v *Plugin_Goodbye_Args) ToWire() (wire.Value, error)
ToWire translates a Plugin_Goodbye_Args struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type Plugin_Goodbye_Result ¶ added in v0.5.0
type Plugin_Goodbye_Result struct { }
Plugin_Goodbye_Result represents the result of a Plugin.goodbye function call.
The result of a goodbye execution is sent and received over the wire as this struct.
func (*Plugin_Goodbye_Result) EnvelopeType ¶ added in v0.5.0
func (v *Plugin_Goodbye_Result) EnvelopeType() wire.EnvelopeType
EnvelopeType returns the kind of value inside this struct.
This will always be Reply for this struct.
func (*Plugin_Goodbye_Result) Equals ¶ added in v1.2.0
func (v *Plugin_Goodbye_Result) Equals(rhs *Plugin_Goodbye_Result) bool
Equals returns true if all the fields of this Plugin_Goodbye_Result match the provided Plugin_Goodbye_Result.
This function performs a deep comparison.
func (*Plugin_Goodbye_Result) FromWire ¶ added in v0.5.0
func (v *Plugin_Goodbye_Result) FromWire(w wire.Value) error
FromWire deserializes a Plugin_Goodbye_Result struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a Plugin_Goodbye_Result struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v Plugin_Goodbye_Result if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*Plugin_Goodbye_Result) MethodName ¶ added in v0.5.0
func (v *Plugin_Goodbye_Result) MethodName() string
MethodName returns the name of the Thrift function as specified in the IDL, for which this struct represent the result.
This will always be "goodbye" for this struct.
func (*Plugin_Goodbye_Result) String ¶ added in v0.5.0
func (v *Plugin_Goodbye_Result) String() string
String returns a readable string representation of a Plugin_Goodbye_Result struct.
func (*Plugin_Goodbye_Result) ToWire ¶ added in v0.5.0
func (v *Plugin_Goodbye_Result) ToWire() (wire.Value, error)
ToWire translates a Plugin_Goodbye_Result struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type Plugin_Handshake_Args ¶ added in v0.5.0
type Plugin_Handshake_Args struct {
Request *HandshakeRequest `json:"request,omitempty"`
}
Plugin_Handshake_Args represents the arguments for the Plugin.handshake function.
The arguments for handshake are sent and received over the wire as this struct.
func (*Plugin_Handshake_Args) EnvelopeType ¶ added in v0.5.0
func (v *Plugin_Handshake_Args) EnvelopeType() wire.EnvelopeType
EnvelopeType returns the kind of value inside this struct.
This will always be Call for this struct.
func (*Plugin_Handshake_Args) Equals ¶ added in v1.2.0
func (v *Plugin_Handshake_Args) Equals(rhs *Plugin_Handshake_Args) bool
Equals returns true if all the fields of this Plugin_Handshake_Args match the provided Plugin_Handshake_Args.
This function performs a deep comparison.
func (*Plugin_Handshake_Args) FromWire ¶ added in v0.5.0
func (v *Plugin_Handshake_Args) FromWire(w wire.Value) error
FromWire deserializes a Plugin_Handshake_Args struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a Plugin_Handshake_Args struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v Plugin_Handshake_Args if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*Plugin_Handshake_Args) MethodName ¶ added in v0.5.0
func (v *Plugin_Handshake_Args) MethodName() string
MethodName returns the name of the Thrift function as specified in the IDL, for which this struct represent the arguments.
This will always be "handshake" for this struct.
func (*Plugin_Handshake_Args) String ¶ added in v0.5.0
func (v *Plugin_Handshake_Args) String() string
String returns a readable string representation of a Plugin_Handshake_Args struct.
func (*Plugin_Handshake_Args) ToWire ¶ added in v0.5.0
func (v *Plugin_Handshake_Args) ToWire() (wire.Value, error)
ToWire translates a Plugin_Handshake_Args struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type Plugin_Handshake_Result ¶ added in v0.5.0
type Plugin_Handshake_Result struct { // Value returned by handshake after a successful execution. Success *HandshakeResponse `json:"success,omitempty"` }
Plugin_Handshake_Result represents the result of a Plugin.handshake function call.
The result of a handshake execution is sent and received over the wire as this struct.
Success is set only if the function did not throw an exception.
func (*Plugin_Handshake_Result) EnvelopeType ¶ added in v0.5.0
func (v *Plugin_Handshake_Result) EnvelopeType() wire.EnvelopeType
EnvelopeType returns the kind of value inside this struct.
This will always be Reply for this struct.
func (*Plugin_Handshake_Result) Equals ¶ added in v1.2.0
func (v *Plugin_Handshake_Result) Equals(rhs *Plugin_Handshake_Result) bool
Equals returns true if all the fields of this Plugin_Handshake_Result match the provided Plugin_Handshake_Result.
This function performs a deep comparison.
func (*Plugin_Handshake_Result) FromWire ¶ added in v0.5.0
func (v *Plugin_Handshake_Result) FromWire(w wire.Value) error
FromWire deserializes a Plugin_Handshake_Result struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a Plugin_Handshake_Result struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v Plugin_Handshake_Result if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*Plugin_Handshake_Result) MethodName ¶ added in v0.5.0
func (v *Plugin_Handshake_Result) MethodName() string
MethodName returns the name of the Thrift function as specified in the IDL, for which this struct represent the result.
This will always be "handshake" for this struct.
func (*Plugin_Handshake_Result) String ¶ added in v0.5.0
func (v *Plugin_Handshake_Result) String() string
String returns a readable string representation of a Plugin_Handshake_Result struct.
func (*Plugin_Handshake_Result) ToWire ¶ added in v0.5.0
func (v *Plugin_Handshake_Result) ToWire() (wire.Value, error)
ToWire translates a Plugin_Handshake_Result struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type Service ¶
type Service struct { // Name of the Thrift service in Go code. Name string `json:"name,required"` // Name of the service as defined in the Thrift file. ThriftName string `json:"thriftName,required"` // ID of the parent service. ParentID *ServiceID `json:"parentID,omitempty"` // List of functions defined for this service. Functions []*Function `json:"functions,required"` // ID of the module where this service was declared. ModuleID ModuleID `json:"moduleID,required"` }
Service is a service defined by the user in the Thrift file.
func (*Service) Equals ¶ added in v1.2.0
Equals returns true if all the fields of this Service match the provided Service.
This function performs a deep comparison.
func (*Service) FromWire ¶
FromWire deserializes a Service struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a Service struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v Service if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*Service) GetParentID ¶ added in v1.7.0
GetParentID returns the value of ParentID if it is set or its zero value if it is unset.
func (*Service) ToWire ¶
ToWire translates a Service struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type ServiceGenerator ¶
type ServiceGenerator interface { Generate( Request *GenerateServiceRequest, ) (*GenerateServiceResponse, error) }
func NewServiceGeneratorClient ¶ added in v0.5.0
func NewServiceGeneratorClient(c envelope.Client) ServiceGenerator
NewServiceGeneratorClient builds a new ServiceGenerator client.
type ServiceGeneratorHandler ¶ added in v0.5.0
type ServiceGeneratorHandler struct {
// contains filtered or unexported fields
}
ServiceGeneratorHandler serves an implementation of the ServiceGenerator service.
func NewServiceGeneratorHandler ¶ added in v0.5.0
func NewServiceGeneratorHandler(service ServiceGenerator) ServiceGeneratorHandler
NewServiceGeneratorHandler builds a new ServiceGenerator handler.
type ServiceGenerator_Generate_Args ¶ added in v0.5.0
type ServiceGenerator_Generate_Args struct {
Request *GenerateServiceRequest `json:"request,omitempty"`
}
ServiceGenerator_Generate_Args represents the arguments for the ServiceGenerator.generate function.
The arguments for generate are sent and received over the wire as this struct.
func (*ServiceGenerator_Generate_Args) EnvelopeType ¶ added in v0.5.0
func (v *ServiceGenerator_Generate_Args) EnvelopeType() wire.EnvelopeType
EnvelopeType returns the kind of value inside this struct.
This will always be Call for this struct.
func (*ServiceGenerator_Generate_Args) Equals ¶ added in v1.2.0
func (v *ServiceGenerator_Generate_Args) Equals(rhs *ServiceGenerator_Generate_Args) bool
Equals returns true if all the fields of this ServiceGenerator_Generate_Args match the provided ServiceGenerator_Generate_Args.
This function performs a deep comparison.
func (*ServiceGenerator_Generate_Args) FromWire ¶ added in v0.5.0
func (v *ServiceGenerator_Generate_Args) FromWire(w wire.Value) error
FromWire deserializes a ServiceGenerator_Generate_Args struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a ServiceGenerator_Generate_Args struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v ServiceGenerator_Generate_Args if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*ServiceGenerator_Generate_Args) MethodName ¶ added in v0.5.0
func (v *ServiceGenerator_Generate_Args) MethodName() string
MethodName returns the name of the Thrift function as specified in the IDL, for which this struct represent the arguments.
This will always be "generate" for this struct.
func (*ServiceGenerator_Generate_Args) String ¶ added in v0.5.0
func (v *ServiceGenerator_Generate_Args) String() string
String returns a readable string representation of a ServiceGenerator_Generate_Args struct.
func (*ServiceGenerator_Generate_Args) ToWire ¶ added in v0.5.0
func (v *ServiceGenerator_Generate_Args) ToWire() (wire.Value, error)
ToWire translates a ServiceGenerator_Generate_Args struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type ServiceGenerator_Generate_Result ¶ added in v0.5.0
type ServiceGenerator_Generate_Result struct { // Value returned by generate after a successful execution. Success *GenerateServiceResponse `json:"success,omitempty"` }
ServiceGenerator_Generate_Result represents the result of a ServiceGenerator.generate function call.
The result of a generate execution is sent and received over the wire as this struct.
Success is set only if the function did not throw an exception.
func (*ServiceGenerator_Generate_Result) EnvelopeType ¶ added in v0.5.0
func (v *ServiceGenerator_Generate_Result) EnvelopeType() wire.EnvelopeType
EnvelopeType returns the kind of value inside this struct.
This will always be Reply for this struct.
func (*ServiceGenerator_Generate_Result) Equals ¶ added in v1.2.0
func (v *ServiceGenerator_Generate_Result) Equals(rhs *ServiceGenerator_Generate_Result) bool
Equals returns true if all the fields of this ServiceGenerator_Generate_Result match the provided ServiceGenerator_Generate_Result.
This function performs a deep comparison.
func (*ServiceGenerator_Generate_Result) FromWire ¶ added in v0.5.0
func (v *ServiceGenerator_Generate_Result) FromWire(w wire.Value) error
FromWire deserializes a ServiceGenerator_Generate_Result struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a ServiceGenerator_Generate_Result struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v ServiceGenerator_Generate_Result if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*ServiceGenerator_Generate_Result) MethodName ¶ added in v0.5.0
func (v *ServiceGenerator_Generate_Result) MethodName() string
MethodName returns the name of the Thrift function as specified in the IDL, for which this struct represent the result.
This will always be "generate" for this struct.
func (*ServiceGenerator_Generate_Result) String ¶ added in v0.5.0
func (v *ServiceGenerator_Generate_Result) String() string
String returns a readable string representation of a ServiceGenerator_Generate_Result struct.
func (*ServiceGenerator_Generate_Result) ToWire ¶ added in v0.5.0
func (v *ServiceGenerator_Generate_Result) ToWire() (wire.Value, error)
ToWire translates a ServiceGenerator_Generate_Result struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type ServiceID ¶
type ServiceID int32
ServiceID is an arbitrary unique identifier to reference the different services in this request.
func (ServiceID) Equals ¶ added in v1.2.0
Equals returns true if this ServiceID is equal to the provided ServiceID.
func (*ServiceID) FromWire ¶
FromWire deserializes ServiceID from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
type SimpleType ¶
type SimpleType int32
SimpleType is a standalone native Go type.
const ( SimpleTypeBool SimpleType = 1 SimpleTypeByte SimpleType = 2 SimpleTypeInt8 SimpleType = 3 SimpleTypeInt16 SimpleType = 4 SimpleTypeInt32 SimpleType = 5 SimpleTypeInt64 SimpleType = 6 SimpleTypeFloat64 SimpleType = 7 SimpleTypeString SimpleType = 8 SimpleTypeStructEmpty SimpleType = 9 )
func SimpleType_Values ¶ added in v1.3.0
func SimpleType_Values() []SimpleType
SimpleType_Values returns all recognized values of SimpleType.
func (SimpleType) Equals ¶ added in v1.2.0
func (v SimpleType) Equals(rhs SimpleType) bool
Equals returns true if this SimpleType value matches the provided value.
func (*SimpleType) FromWire ¶
func (v *SimpleType) FromWire(w wire.Value) error
FromWire deserializes SimpleType from its Thrift-level representation.
x, err := binaryProtocol.Decode(reader, wire.TI32) if err != nil { return SimpleType(0), err } var v SimpleType if err := v.FromWire(x); err != nil { return SimpleType(0), err } return v, nil
func (SimpleType) MarshalJSON ¶ added in v0.5.0
func (v SimpleType) MarshalJSON() ([]byte, error)
MarshalJSON serializes SimpleType into JSON.
If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.
This implements json.Marshaler.
func (SimpleType) String ¶
func (v SimpleType) String() string
String returns a readable string representation of SimpleType.
func (SimpleType) ToWire ¶
func (v SimpleType) ToWire() (wire.Value, error)
ToWire translates SimpleType into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
Enums are represented as 32-bit integers over the wire.
func (*SimpleType) UnmarshalJSON ¶ added in v0.5.0
func (v *SimpleType) UnmarshalJSON(text []byte) error
UnmarshalJSON attempts to decode SimpleType from its JSON representation.
This implementation supports both, numeric and string inputs. If a string is provided, it must be a known enum name.
This implements json.Unmarshaler.
func (*SimpleType) UnmarshalText ¶ added in v1.3.0
func (v *SimpleType) UnmarshalText(value []byte) error
UnmarshalText tries to decode SimpleType from a byte slice containing its name.
var v SimpleType err := v.UnmarshalText([]byte("BOOL"))
type Type ¶
type Type struct { SimpleType *SimpleType `json:"simpleType,omitempty"` // Slice of a type // // []$sliceType SliceType *Type `json:"sliceType,omitempty"` // Slice of key-value pairs of a pair of types. // // []struct{Key $left, Value $right} KeyValueSliceType *TypePair `json:"keyValueSliceType,omitempty"` // Map of a pair of types. // // map[$left]$right MapType *TypePair `json:"mapType,omitempty"` // Reference to a user-defined type. ReferenceType *TypeReference `json:"referenceType,omitempty"` // Pointer to a type. PointerType *Type `json:"pointerType,omitempty"` }
Type is a reference to a Go type which may be native or user defined.
func (*Type) Equals ¶ added in v1.2.0
Equals returns true if all the fields of this Type match the provided Type.
This function performs a deep comparison.
func (*Type) FromWire ¶
FromWire deserializes a Type struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a Type struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v Type if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*Type) GetSimpleType ¶ added in v1.7.0
func (v *Type) GetSimpleType() (o SimpleType)
GetSimpleType returns the value of SimpleType if it is set or its zero value if it is unset.
func (*Type) ToWire ¶
ToWire translates a Type struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type TypePair ¶
TypePair is a pair of two types.
func (*TypePair) Equals ¶ added in v1.2.0
Equals returns true if all the fields of this TypePair match the provided TypePair.
This function performs a deep comparison.
func (*TypePair) FromWire ¶
FromWire deserializes a TypePair struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a TypePair struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v TypePair if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*TypePair) ToWire ¶
ToWire translates a TypePair struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }
type TypeReference ¶
type TypeReference struct { Name string `json:"name,required"` // Import path for the package defining this type. ImportPath string `json:"importPath,required"` // Annotations defined on this type. // // Note that these are the Thrift annotations listed after the type // declaration in the Thrift file. // // Given, // // struct User { // 1: required i32 id // 2: required string name // } (key = "id", validate) // // The annotations will be, // // { // "key": "id", // "validate": "", // } Annotations map[string]string `json:"annotations,omitempty"` }
TypeReference is a reference to a user-defined type.
func (*TypeReference) Equals ¶ added in v1.2.0
func (v *TypeReference) Equals(rhs *TypeReference) bool
Equals returns true if all the fields of this TypeReference match the provided TypeReference.
This function performs a deep comparison.
func (*TypeReference) FromWire ¶
func (v *TypeReference) FromWire(w wire.Value) error
FromWire deserializes a TypeReference struct from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.
An error is returned if we were unable to build a TypeReference struct from the provided intermediate representation.
x, err := binaryProtocol.Decode(reader, wire.TStruct) if err != nil { return nil, err } var v TypeReference if err := v.FromWire(x); err != nil { return nil, err } return &v, nil
func (*TypeReference) String ¶
func (v *TypeReference) String() string
String returns a readable string representation of a TypeReference struct.
func (*TypeReference) ToWire ¶
func (v *TypeReference) ToWire() (wire.Value, error)
ToWire translates a TypeReference struct into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.
An error is returned if the struct or any of its fields failed to validate.
x, err := v.ToWire() if err != nil { return err } if err := binaryProtocol.Encode(x, writer); err != nil { return err }