api

package
Version: v1.28.0 Latest Latest
Warning

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

Go to latest
Published: Jul 26, 2021 License: MIT Imports: 13 Imported by: 14

Documentation

Index

Constants

View Source
const APIVersion int32 = 4

API_VERSION is the version of the plugin API.

This MUST be provided in the HandshakeResponse.

Variables

View Source
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.

View Source
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.

View Source
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.

View Source
var ThriftModule = &thriftreflect.ThriftModule{
	Name:     "api",
	Package:  "go.uber.org/thriftrw/plugin/api",
	FilePath: "api.thrift",
	SHA1:     "f7eeea00e3002a17188f595c7117b9359ab244d3",
	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"`
	// Annotations defined on this argument.
	//
	// Given,
	//
	//   void setValue(
	//     1: SetValueRequest req
	//   ) throws (
	//     1: BadRequestError badRequestError (cache = "false")
	//   )
	//
	// The annotations for the Argument representing badRequestError will be,
	//
	//  {
	//    "cache": "false",
	//  }
	Annotations map[string]string `json:"annotations,omitempty"`
}

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

func (v *Argument) Equals(rhs *Argument) bool

Equals returns true if all the fields of this Argument match the provided Argument.

This function performs a deep comparison.

func (*Argument) FromWire

func (v *Argument) FromWire(w wire.Value) error

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) GetAnnotations added in v1.22.0

func (v *Argument) GetAnnotations() (o map[string]string)

GetAnnotations returns the value of Annotations if it is set or its zero value if it is unset.

func (*Argument) GetName added in v1.13.0

func (v *Argument) GetName() (o string)

GetName returns the value of Name if it is set or its zero value if it is unset.

func (*Argument) GetType added in v1.13.0

func (v *Argument) GetType() (o *Type)

GetType returns the value of Type if it is set or its zero value if it is unset.

func (*Argument) IsSetAnnotations added in v1.22.0

func (v *Argument) IsSetAnnotations() bool

IsSetAnnotations returns true if Annotations is not nil.

func (*Argument) IsSetType added in v1.14.0

func (v *Argument) IsSetType() bool

IsSetType returns true if Type is not nil.

func (*Argument) MarshalLogObject added in v1.13.0

func (v *Argument) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of Argument.

func (*Argument) String

func (v *Argument) String() string

String returns a readable string representation of a Argument struct.

func (*Argument) ToWire

func (v *Argument) ToWire() (wire.Value, error)

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

func (v Feature) Equals(rhs Feature) bool

Equals returns true if this Feature value matches the provided value.

func (*Feature) FromWire

func (v *Feature) FromWire(w wire.Value) error

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

func (v Feature) MarshalJSON() ([]byte, error)

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) MarshalLogObject added in v1.13.0

func (v Feature) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of Feature. Enums are logged as objects, where the value is logged with key "value", and if this value's name is known, the name is logged with key "name".

func (Feature) MarshalText added in v1.13.0

func (v Feature) MarshalText() ([]byte, error)

MarshalText encodes Feature to text.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements the TextMarshaler interface.

func (Feature) Ptr added in v1.9.0

func (v Feature) Ptr() *Feature

Ptr returns a pointer to this enum value.

func (Feature) String

func (v Feature) String() string

String returns a readable string representation of Feature.

func (Feature) ToWire

func (v Feature) ToWire() (wire.Value, error)

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

func (v *Feature) UnmarshalJSON(text []byte) error

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

func (v *Feature) UnmarshalText(value []byte) error

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"`
	// Annotations defined on this function.
	//
	// Given,
	//
	//   void setValue(1: SetValueRequest req) (cache = "false")
	//
	// The annotations will be,
	//
	//  {
	//    "cache": "false",
	//  }
	Annotations map[string]string `json:"annotations,omitempty"`
}

Function is a single function on a Thrift service.

func (*Function) Equals added in v1.2.0

func (v *Function) Equals(rhs *Function) bool

Equals returns true if all the fields of this Function match the provided Function.

This function performs a deep comparison.

func (*Function) FromWire

func (v *Function) FromWire(w wire.Value) error

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) GetAnnotations added in v1.13.0

func (v *Function) GetAnnotations() (o map[string]string)

GetAnnotations returns the value of Annotations if it is set or its zero value if it is unset.

func (*Function) GetArguments added in v1.13.0

func (v *Function) GetArguments() (o []*Argument)

GetArguments returns the value of Arguments if it is set or its zero value if it is unset.

func (*Function) GetExceptions added in v1.13.0

func (v *Function) GetExceptions() (o []*Argument)

GetExceptions returns the value of Exceptions if it is set or its zero value if it is unset.

func (*Function) GetName added in v1.13.0

func (v *Function) GetName() (o string)

GetName returns the value of Name if it is set or its zero value if it is unset.

func (*Function) GetOneWay added in v1.7.0

func (v *Function) GetOneWay() (o bool)

GetOneWay returns the value of OneWay if it is set or its zero value if it is unset.

func (*Function) GetReturnType added in v1.13.0

func (v *Function) GetReturnType() (o *Type)

GetReturnType returns the value of ReturnType if it is set or its zero value if it is unset.

func (*Function) GetThriftName added in v1.13.0

func (v *Function) GetThriftName() (o string)

GetThriftName returns the value of ThriftName if it is set or its zero value if it is unset.

func (*Function) IsSetAnnotations added in v1.14.0

func (v *Function) IsSetAnnotations() bool

IsSetAnnotations returns true if Annotations is not nil.

func (*Function) IsSetArguments added in v1.14.0

func (v *Function) IsSetArguments() bool

IsSetArguments returns true if Arguments is not nil.

func (*Function) IsSetExceptions added in v1.14.0

func (v *Function) IsSetExceptions() bool

IsSetExceptions returns true if Exceptions is not nil.

func (*Function) IsSetOneWay added in v1.14.0

func (v *Function) IsSetOneWay() bool

IsSetOneWay returns true if OneWay is not nil.

func (*Function) IsSetReturnType added in v1.14.0

func (v *Function) IsSetReturnType() bool

IsSetReturnType returns true if ReturnType is not nil.

func (*Function) MarshalLogObject added in v1.13.0

func (v *Function) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of Function.

func (*Function) String

func (v *Function) String() string

String returns a readable string representation of a Function struct.

func (*Function) ToWire

func (v *Function) ToWire() (wire.Value, error)

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"`
	// Prefix for import paths of generated module. In general, plugins should
	// not need to use the package prefix unless instantiating a new
	// Generator for more custom plugin generation.
	PackagePrefix string `json:"packagePrefix,required"`
	// Directory whose descendants contain all Thrift files. In general,
	// plugins should not need to use the thrift root unless instantiating a
	// new Generator for more custom plugin generation.
	ThriftRoot string `json:"thriftRoot,required"`
	// IDs of Modules for which code should be generated.
	//
	// Note that the modules map contains information about both, the
	// modules being generated and their transitive dependencies. Code should
	// only be generated for module IDs listed here.
	RootModules []ModuleID `json:"rootModules,omitempty"`
}

GenerateServiceRequest is a request to generate code for zero or more Thrift services.

func (*GenerateServiceRequest) Equals added in v1.2.0

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) GetModules added in v1.13.0

func (v *GenerateServiceRequest) GetModules() (o map[ModuleID]*Module)

GetModules returns the value of Modules if it is set or its zero value if it is unset.

func (*GenerateServiceRequest) GetPackagePrefix added in v1.16.0

func (v *GenerateServiceRequest) GetPackagePrefix() (o string)

GetPackagePrefix returns the value of PackagePrefix if it is set or its zero value if it is unset.

func (*GenerateServiceRequest) GetRootModules added in v1.25.0

func (v *GenerateServiceRequest) GetRootModules() (o []ModuleID)

GetRootModules returns the value of RootModules if it is set or its zero value if it is unset.

func (*GenerateServiceRequest) GetRootServices added in v1.13.0

func (v *GenerateServiceRequest) GetRootServices() (o []ServiceID)

GetRootServices returns the value of RootServices if it is set or its zero value if it is unset.

func (*GenerateServiceRequest) GetServices added in v1.13.0

func (v *GenerateServiceRequest) GetServices() (o map[ServiceID]*Service)

GetServices returns the value of Services if it is set or its zero value if it is unset.

func (*GenerateServiceRequest) GetThriftRoot added in v1.16.0

func (v *GenerateServiceRequest) GetThriftRoot() (o string)

GetThriftRoot returns the value of ThriftRoot if it is set or its zero value if it is unset.

func (*GenerateServiceRequest) IsSetModules added in v1.14.0

func (v *GenerateServiceRequest) IsSetModules() bool

IsSetModules returns true if Modules is not nil.

func (*GenerateServiceRequest) IsSetRootModules added in v1.25.0

func (v *GenerateServiceRequest) IsSetRootModules() bool

IsSetRootModules returns true if RootModules is not nil.

func (*GenerateServiceRequest) IsSetRootServices added in v1.14.0

func (v *GenerateServiceRequest) IsSetRootServices() bool

IsSetRootServices returns true if RootServices is not nil.

func (*GenerateServiceRequest) IsSetServices added in v1.14.0

func (v *GenerateServiceRequest) IsSetServices() bool

IsSetServices returns true if Services is not nil.

func (*GenerateServiceRequest) MarshalLogObject added in v1.13.0

func (v *GenerateServiceRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of GenerateServiceRequest.

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

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) GetFiles added in v1.13.0

func (v *GenerateServiceResponse) GetFiles() (o map[string][]byte)

GetFiles returns the value of Files if it is set or its zero value if it is unset.

func (*GenerateServiceResponse) IsSetFiles added in v1.14.0

func (v *GenerateServiceResponse) IsSetFiles() bool

IsSetFiles returns true if Files is not nil.

func (*GenerateServiceResponse) MarshalLogObject added in v1.13.0

func (v *GenerateServiceResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of GenerateServiceResponse.

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) MarshalLogObject added in v1.13.0

func (v *HandshakeRequest) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of HandshakeRequest.

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) GetAPIVersion added in v1.13.0

func (v *HandshakeResponse) GetAPIVersion() (o int32)

GetAPIVersion returns the value of APIVersion if it is set or its zero value if it is unset.

func (*HandshakeResponse) GetFeatures added in v1.13.0

func (v *HandshakeResponse) GetFeatures() (o []Feature)

GetFeatures returns the value of Features if it is set or its zero value if it is unset.

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) GetName added in v1.13.0

func (v *HandshakeResponse) GetName() (o string)

GetName returns the value of Name if it is set or its zero value if it is unset.

func (*HandshakeResponse) IsSetFeatures added in v1.14.0

func (v *HandshakeResponse) IsSetFeatures() bool

IsSetFeatures returns true if Features is not nil.

func (*HandshakeResponse) IsSetLibraryVersion added in v1.14.0

func (v *HandshakeResponse) IsSetLibraryVersion() bool

IsSetLibraryVersion returns true if LibraryVersion is not nil.

func (*HandshakeResponse) MarshalLogObject added in v1.13.0

func (v *HandshakeResponse) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of HandshakeResponse.

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"`
	// Path to the Thrift file from which this module was generated.
	ThriftFilePath string `json:"thriftFilePath,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

func (v *Module) Equals(rhs *Module) bool

Equals returns true if all the fields of this Module match the provided Module.

This function performs a deep comparison.

func (*Module) FromWire

func (v *Module) FromWire(w wire.Value) error

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) GetDirectory added in v1.13.0

func (v *Module) GetDirectory() (o string)

GetDirectory returns the value of Directory if it is set or its zero value if it is unset.

func (*Module) GetImportPath added in v1.13.0

func (v *Module) GetImportPath() (o string)

GetImportPath returns the value of ImportPath if it is set or its zero value if it is unset.

func (*Module) GetThriftFilePath added in v1.16.0

func (v *Module) GetThriftFilePath() (o string)

GetThriftFilePath returns the value of ThriftFilePath if it is set or its zero value if it is unset.

func (*Module) MarshalLogObject added in v1.13.0

func (v *Module) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of Module.

func (*Module) String

func (v *Module) String() string

String returns a readable string representation of a Module struct.

func (*Module) ToWire

func (v *Module) ToWire() (wire.Value, error)

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

func (lhs ModuleID) Equals(rhs ModuleID) bool

Equals returns true if this ModuleID is equal to the provided ModuleID.

func (*ModuleID) FromWire

func (v *ModuleID) FromWire(w wire.Value) error

FromWire deserializes ModuleID from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.

func (ModuleID) Ptr added in v1.18.0

func (v ModuleID) Ptr() *ModuleID

ModuleIDPtr returns a pointer to a ModuleID

func (ModuleID) String

func (v ModuleID) String() string

String returns a readable string representation of ModuleID.

func (ModuleID) ToWire

func (v ModuleID) ToWire() (wire.Value, error)

ToWire translates ModuleID into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using a ThriftRW protocol implementation.

type Plugin

type Plugin interface {
	Goodbye() error

	Handshake(
		Request *HandshakeRequest,
	) (*HandshakeResponse, error)
}

func NewPluginClient added in v0.5.0

func NewPluginClient(c envelope.Client) Plugin

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.

func (PluginHandler) Handle added in v0.5.0

func (h PluginHandler) Handle(name string, reqValue wire.Value) (wire.Value, error)

Handle receives and handles a request for the Plugin service.

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

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) MarshalLogObject added in v1.13.0

func (v *Plugin_Goodbye_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of Plugin_Goodbye_Args.

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

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) MarshalLogObject added in v1.13.0

func (v *Plugin_Goodbye_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of Plugin_Goodbye_Result.

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

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) GetRequest added in v1.13.0

func (v *Plugin_Handshake_Args) GetRequest() (o *HandshakeRequest)

GetRequest returns the value of Request if it is set or its zero value if it is unset.

func (*Plugin_Handshake_Args) IsSetRequest added in v1.14.0

func (v *Plugin_Handshake_Args) IsSetRequest() bool

IsSetRequest returns true if Request is not nil.

func (*Plugin_Handshake_Args) MarshalLogObject added in v1.13.0

func (v *Plugin_Handshake_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of Plugin_Handshake_Args.

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

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) GetSuccess added in v1.13.0

func (v *Plugin_Handshake_Result) GetSuccess() (o *HandshakeResponse)

GetSuccess returns the value of Success if it is set or its zero value if it is unset.

func (*Plugin_Handshake_Result) IsSetSuccess added in v1.14.0

func (v *Plugin_Handshake_Result) IsSetSuccess() bool

IsSetSuccess returns true if Success is not nil.

func (*Plugin_Handshake_Result) MarshalLogObject added in v1.13.0

func (v *Plugin_Handshake_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of Plugin_Handshake_Result.

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"`
	// Annotations defined on this service.
	//
	// Given,
	//
	//   service KeyValue {
	//   } (private = "true")
	//
	// The annotations will be,
	//
	//  {
	//    "private": "true",
	//  }
	Annotations map[string]string `json:"annotations,omitempty"`
}

Service is a service defined by the user in the Thrift file.

func (*Service) Equals added in v1.2.0

func (v *Service) Equals(rhs *Service) bool

Equals returns true if all the fields of this Service match the provided Service.

This function performs a deep comparison.

func (*Service) FromWire

func (v *Service) FromWire(w wire.Value) error

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) GetAnnotations added in v1.13.0

func (v *Service) GetAnnotations() (o map[string]string)

GetAnnotations returns the value of Annotations if it is set or its zero value if it is unset.

func (*Service) GetFunctions added in v1.13.0

func (v *Service) GetFunctions() (o []*Function)

GetFunctions returns the value of Functions if it is set or its zero value if it is unset.

func (*Service) GetModuleID added in v1.13.0

func (v *Service) GetModuleID() (o ModuleID)

GetModuleID returns the value of ModuleID if it is set or its zero value if it is unset.

func (*Service) GetName added in v1.13.0

func (v *Service) GetName() (o string)

GetName returns the value of Name if it is set or its zero value if it is unset.

func (*Service) GetParentID added in v1.7.0

func (v *Service) GetParentID() (o ServiceID)

GetParentID returns the value of ParentID if it is set or its zero value if it is unset.

func (*Service) GetThriftName added in v1.13.0

func (v *Service) GetThriftName() (o string)

GetThriftName returns the value of ThriftName if it is set or its zero value if it is unset.

func (*Service) IsSetAnnotations added in v1.14.0

func (v *Service) IsSetAnnotations() bool

IsSetAnnotations returns true if Annotations is not nil.

func (*Service) IsSetFunctions added in v1.14.0

func (v *Service) IsSetFunctions() bool

IsSetFunctions returns true if Functions is not nil.

func (*Service) IsSetParentID added in v1.14.0

func (v *Service) IsSetParentID() bool

IsSetParentID returns true if ParentID is not nil.

func (*Service) MarshalLogObject added in v1.13.0

func (v *Service) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of Service.

func (*Service) String

func (v *Service) String() string

String returns a readable string representation of a Service struct.

func (*Service) ToWire

func (v *Service) ToWire() (wire.Value, error)

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.

func (ServiceGeneratorHandler) Handle added in v0.5.0

func (h ServiceGeneratorHandler) Handle(name string, reqValue wire.Value) (wire.Value, error)

Handle receives and handles a request for the ServiceGenerator service.

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

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

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

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) GetRequest added in v1.13.0

GetRequest returns the value of Request if it is set or its zero value if it is unset.

func (*ServiceGenerator_Generate_Args) IsSetRequest added in v1.14.0

func (v *ServiceGenerator_Generate_Args) IsSetRequest() bool

IsSetRequest returns true if Request is not nil.

func (*ServiceGenerator_Generate_Args) MarshalLogObject added in v1.13.0

func (v *ServiceGenerator_Generate_Args) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of ServiceGenerator_Generate_Args.

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

String returns a readable string representation of a ServiceGenerator_Generate_Args struct.

func (*ServiceGenerator_Generate_Args) ToWire added in v0.5.0

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

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

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

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) GetSuccess added in v1.13.0

GetSuccess returns the value of Success if it is set or its zero value if it is unset.

func (*ServiceGenerator_Generate_Result) IsSetSuccess added in v1.14.0

func (v *ServiceGenerator_Generate_Result) IsSetSuccess() bool

IsSetSuccess returns true if Success is not nil.

func (*ServiceGenerator_Generate_Result) MarshalLogObject added in v1.13.0

func (v *ServiceGenerator_Generate_Result) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of ServiceGenerator_Generate_Result.

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

String returns a readable string representation of a ServiceGenerator_Generate_Result struct.

func (*ServiceGenerator_Generate_Result) ToWire added in v0.5.0

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

func (lhs ServiceID) Equals(rhs ServiceID) bool

Equals returns true if this ServiceID is equal to the provided ServiceID.

func (*ServiceID) FromWire

func (v *ServiceID) FromWire(w wire.Value) error

FromWire deserializes ServiceID from its Thrift-level representation. The Thrift-level representation may be obtained from a ThriftRW protocol implementation.

func (ServiceID) Ptr added in v1.18.0

func (v ServiceID) Ptr() *ServiceID

ServiceIDPtr returns a pointer to a ServiceID

func (ServiceID) String

func (v ServiceID) String() string

String returns a readable string representation of ServiceID.

func (ServiceID) ToWire

func (v ServiceID) ToWire() (wire.Value, error)

ToWire translates ServiceID into a Thrift-level intermediate representation. This intermediate representation may be serialized into bytes using 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) MarshalLogObject added in v1.13.0

func (v SimpleType) MarshalLogObject(enc zapcore.ObjectEncoder) error

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of SimpleType. Enums are logged as objects, where the value is logged with key "value", and if this value's name is known, the name is logged with key "name".

func (SimpleType) MarshalText added in v1.13.0

func (v SimpleType) MarshalText() ([]byte, error)

MarshalText encodes SimpleType to text.

If the enum value is recognized, its name is returned. Otherwise, its integer value is returned.

This implements the TextMarshaler interface.

func (SimpleType) Ptr added in v1.9.0

func (v SimpleType) Ptr() *SimpleType

Ptr returns a pointer to this enum value.

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

func (v *Type) Equals(rhs *Type) bool

Equals returns true if all the fields of this Type match the provided Type.

This function performs a deep comparison.

func (*Type) FromWire

func (v *Type) FromWire(w wire.Value) error

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) GetKeyValueSliceType added in v1.13.0

func (v *Type) GetKeyValueSliceType() (o *TypePair)

GetKeyValueSliceType returns the value of KeyValueSliceType if it is set or its zero value if it is unset.

func (*Type) GetMapType added in v1.13.0

func (v *Type) GetMapType() (o *TypePair)

GetMapType returns the value of MapType if it is set or its zero value if it is unset.

func (*Type) GetPointerType added in v1.13.0

func (v *Type) GetPointerType() (o *Type)

GetPointerType returns the value of PointerType if it is set or its zero value if it is unset.

func (*Type) GetReferenceType added in v1.13.0

func (v *Type) GetReferenceType() (o *TypeReference)

GetReferenceType returns the value of ReferenceType if it is set or its zero value if it is unset.

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) GetSliceType added in v1.13.0

func (v *Type) GetSliceType() (o *Type)

GetSliceType returns the value of SliceType if it is set or its zero value if it is unset.

func (*Type) IsSetKeyValueSliceType added in v1.14.0

func (v *Type) IsSetKeyValueSliceType() bool

IsSetKeyValueSliceType returns true if KeyValueSliceType is not nil.

func (*Type) IsSetMapType added in v1.14.0

func (v *Type) IsSetMapType() bool

IsSetMapType returns true if MapType is not nil.

func (*Type) IsSetPointerType added in v1.14.0

func (v *Type) IsSetPointerType() bool

IsSetPointerType returns true if PointerType is not nil.

func (*Type) IsSetReferenceType added in v1.14.0

func (v *Type) IsSetReferenceType() bool

IsSetReferenceType returns true if ReferenceType is not nil.

func (*Type) IsSetSimpleType added in v1.14.0

func (v *Type) IsSetSimpleType() bool

IsSetSimpleType returns true if SimpleType is not nil.

func (*Type) IsSetSliceType added in v1.14.0

func (v *Type) IsSetSliceType() bool

IsSetSliceType returns true if SliceType is not nil.

func (*Type) MarshalLogObject added in v1.13.0

func (v *Type) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of Type.

func (*Type) String

func (v *Type) String() string

String returns a readable string representation of a Type struct.

func (*Type) ToWire

func (v *Type) ToWire() (wire.Value, error)

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

type TypePair struct {
	Left  *Type `json:"left,required"`
	Right *Type `json:"right,required"`
}

TypePair is a pair of two types.

func (*TypePair) Equals added in v1.2.0

func (v *TypePair) Equals(rhs *TypePair) bool

Equals returns true if all the fields of this TypePair match the provided TypePair.

This function performs a deep comparison.

func (*TypePair) FromWire

func (v *TypePair) FromWire(w wire.Value) error

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) GetLeft added in v1.13.0

func (v *TypePair) GetLeft() (o *Type)

GetLeft returns the value of Left if it is set or its zero value if it is unset.

func (*TypePair) GetRight added in v1.13.0

func (v *TypePair) GetRight() (o *Type)

GetRight returns the value of Right if it is set or its zero value if it is unset.

func (*TypePair) IsSetLeft added in v1.14.0

func (v *TypePair) IsSetLeft() bool

IsSetLeft returns true if Left is not nil.

func (*TypePair) IsSetRight added in v1.14.0

func (v *TypePair) IsSetRight() bool

IsSetRight returns true if Right is not nil.

func (*TypePair) MarshalLogObject added in v1.13.0

func (v *TypePair) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of TypePair.

func (*TypePair) String

func (v *TypePair) String() string

String returns a readable string representation of a TypePair struct.

func (*TypePair) ToWire

func (v *TypePair) ToWire() (wire.Value, error)

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) GetAnnotations added in v1.13.0

func (v *TypeReference) GetAnnotations() (o map[string]string)

GetAnnotations returns the value of Annotations if it is set or its zero value if it is unset.

func (*TypeReference) GetImportPath added in v1.13.0

func (v *TypeReference) GetImportPath() (o string)

GetImportPath returns the value of ImportPath if it is set or its zero value if it is unset.

func (*TypeReference) GetName added in v1.13.0

func (v *TypeReference) GetName() (o string)

GetName returns the value of Name if it is set or its zero value if it is unset.

func (*TypeReference) IsSetAnnotations added in v1.14.0

func (v *TypeReference) IsSetAnnotations() bool

IsSetAnnotations returns true if Annotations is not nil.

func (*TypeReference) MarshalLogObject added in v1.13.0

func (v *TypeReference) MarshalLogObject(enc zapcore.ObjectEncoder) (err error)

MarshalLogObject implements zapcore.ObjectMarshaler, enabling fast logging of TypeReference.

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
}

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL